www.digitalmars.com         C & C++   DMDScript  

c++ - Editor mangles source

reply Nicholas Jordan <Nicholas_member pathlink.com> writes:
I was trying to get going using the IDDE from the cd-rom - just banging around
and I got a compiler error that the function prototype mismatched the
definition.  When I went to look, it looked really squirrely:

/////// forward function declarations ////////
namespace the 
{
`//takes char *, returns line count
size_t __stdcall ascii_string(char* in_buffer,size_t count_,size_t bufsize_);
//takes a generic string and returns an int
__inline signed int __stdcall  chopper(char * in_,size_t len_);


is what it is supposed to looklike, but for some reason the declaration looked
like this:

namespace the
{
ascii_string(char* in_buffer,size_t count_,size_t bufsize_);//takes char *,
returns line count
__inline signed in
size_t __stdcall t __stdcall  chopper(char * in_,size_t len_);//takes a generic
string and returns an int

notice the misplaced t, which is supposed to be the t in int , the return type

I have been working on this project for years and have decided to go to another
compiler other than the Mighty Cash Cow - I know from experience the way to get
up is to start fixing compiler errors, but I never heard of an editor trashing
your source code ... some of the guys who work in this industry are ace_smart
and I would like for somebody to tell me how to report this without getting them
irked at me.

Nicholas Jordan - ab5_041 inbox.com
"The only dumb question is one you should have asked and didn't."
Aug 07 2005
parent reply "Walter" <newshound digitalmars.com> writes:
I've never seen that happen before.
Aug 08 2005
parent reply Nicholas Jordan <Nicholas_member pathlink.com> writes:
In article <dd77kk$21hl$1 digitaldaemon.com>, Walter says...
I've never seen that happen before.
I will re-try this numerous times b4 continuing this thread, but I checked the behavior several times before reporting - including using one or two other editors to revert to correct - and it would come up as reported; or would not have brougth this up. Nicholas Jordan http://www.docdubya.com/belvedere/statement.html
Aug 09 2005
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dda6nh$286s$1 digitaldaemon.com...
 In article <dd77kk$21hl$1 digitaldaemon.com>, Walter says...
I've never seen that happen before.
I will re-try this numerous times b4 continuing this thread, but I checked
the
 behavior several times before reporting - including using one or two other
 editors to revert to correct - and it would come up as reported; or would
not
 have brougth this up.
I believe you, it's just that the editor has been unchanged for many years, and nobody else has reported it. So something is unique about your setup.
Aug 09 2005
parent Nicholas Jordan <Nicholas_member pathlink.com> writes:
In article <ddc0ve$1kj7$1 digitaldaemon.com>, Walter says...
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dda6nh$286s$1 digitaldaemon.com...
 In article <dd77kk$21hl$1 digitaldaemon.com>, Walter says...
I've never seen that happen before.
I will re-try this numerous times b4 continuing this thread, but I checked
the
 behavior several times before reporting - including using one or two other
 editors to revert to correct - and it would come up as reported; or would
not
 have brougth this up.
I believe you, it's just that the editor has been unchanged for many years, and nobody else has reported it. So something is unique about your setup.
Thanx, I really needed that stabalizer; I am trying to build my first non-trivial class hirearchy and pretty much have to get used to a different 'way of doing things' while reading all of the documentation and it's just a question of knowing where to look. More work to do before continuing this.
Aug 21 2005
prev sibling parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
A suggestion:
Get hold of a Hex-editor and check your source for any non-printable
characters, esp. around the place where chars are disappearing.
Worth a try.
- Rajiv


"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dda6nh$286s$1 digitaldaemon.com...
 In article <dd77kk$21hl$1 digitaldaemon.com>, Walter says...
I've never seen that happen before.
I will re-try this numerous times b4 continuing this thread, but I checked
the
 behavior several times before reporting - including using one or two other
 editors to revert to correct - and it would come up as reported; or would
not
 have brougth this up.

 Nicholas Jordan
 http://www.docdubya.com/belvedere/statement.html
Aug 11 2005
parent reply Nicholas Jordan <Nicholas_member pathlink.com> writes:
In article <ddfi6d$1ht$1 digitaldaemon.com>, Rajiv Bhagwat says...
A suggestion:
Get hold of a Hex-editor and check your source for any non-printable
characters, esp. around the place where chars are disappearing.
Worth a try.
- Rajiv
I am certianly aware of this - Textpad is the only editor with which I know how to open the file in hex right now ( is there a hex-editor that ships with the IDDE ? ) Be though it may, embarrassing, it could be a crashing sys ... Win32 defrag.exe is starting to sift throught the first several hundred little boxes like teflon on ice - previously this occured right before total system failure and trying to squeeze the last little production out of what I have accomplished so far B4 the disk fails or something; I noted the IDDE was using binary (non-printable) characters to do much of it's work ~ So I did a Format logical drive K: and started a new project - this time using only the editor that ships with the IDDE to the greatest extent possible. This seemed to make the compiler less likely to point to errors that were difficult for me to understand, so I went about preening the 500 or so lines of source that I had accomplished so far of functions that I found myself always trying to write or find, I will need these later as a toolkit anyway, to follow the coding style of STL and console programs. I got to the point moments ago of a 0 error build and the IDDE gleefully launched the linker --- trashing my soaring spirit with a Blizzard of linker errors. This all came down to the Guard Def's method - which I know will ultimately make a tangled web of conditional compilations and unexpanded macros, so I set about the task of putting everthing that was in methods.h into methods.cpp and including methods.h at the top of the file - that would be the manner instructed as I read the doc's - placing function signature's in the header file: This seemed to be the recommended method and all that I could understand led me to believe I could ultimately refine a library that I could use when writing programs. This all went fine for the first few functions, then with switches: sc -cpp -HO -mn -C -o+time -WA -Pz -S -3 -a8 -c -H -HDL:\lst -e -gf -sc methods.cpp -cpp -HO -mn -C -o+time -WA -Pz -S -3 -a8 -c -H -HDL:\lst -e -gf -Deq_=== -D_CONSOLE=1 -IL:\dm\stlport\stlport -oL:\lst\methods.obj I get: Fatal Error: L:\itc\methods.cpp(88): internal error cgobj 3141 Lines Processed: 52386 Errors: 1 Build failed In the output window when I transferred my hashing function. Editor problem not as pressing right now. Compiler asks for a semicolon after an opening curley brace: namespace the { [ same with several places in stl ] And also a 'number not representable' Warning that I do not know how to fix. Got any suggestions ? I have no idea where to look to fathom these issues and have several toolkit's I really need to work on right now - especially implementing Knuth 3.3 - instead of Goin South on what is internal to the compiler.
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dda6nh$286s$1 digitaldaemon.com...
 In article <dd77kk$21hl$1 digitaldaemon.com>, Walter says...
I've never seen that happen before.
I will re-try this numerous times b4 continuing this thread, but I checked
the
 behavior several times before reporting - including using one or two other
 editors to revert to correct - and it would come up as reported; or would
not
 have brougth this up.

 Nicholas Jordan
 http://www.docdubya.com/belvedere/statement.html
Sep 04 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dfg0lh$18v$1 digitaldaemon.com...
 In the output window when I transferred my hashing function.  Editor
problem not
 as pressing right now. Compiler asks for a semicolon after an opening
curley
 brace:   namespace the { [ same with several places in stl ] And also a
'number
 not representable'  Warning that I do not know how to fix.

 Got any suggestions ? I have no idea where to look to fathom these issues
If the solution isn't apparent, the most reliable way to find out what is going on is to make a copy of the project, and then start deleting parts of it until what triggers the error becomes obvious.
Sep 04 2005
next sibling parent reply Nicholas Jordan <Nicholas_member pathlink.com> writes:
In article <dfgem7$b86$1 digitaldaemon.com>, Walter Bright says...
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dfg0lh$18v$1 digitaldaemon.com...
 In the output window when I transferred my hashing function.  Editor
problem not
 as pressing right now. Compiler asks for a semicolon after an opening
curley
 brace:   namespace the { [ same with several places in stl ] And also a
'number
 not representable'  Warning that I do not know how to fix.

 Got any suggestions ? I have no idea where to look to fathom these issues
If the solution isn't apparent, the most reliable way to find out what is going on is to make a copy of the project, and then start deleting parts of it until what triggers the error becomes obvious.
That's the simplified version of what I did: Just did without the namespace keyword for now, then got back to where I was; Linker error: Previous Definition Different Figured out how to run: Digital Mars Librarian Version 8.00n But that did not resolve the problem because I couldn't read the assembly listing - The guard def's method seems to be the only way to work on this, but I may be misunderstanding #pragma once and the idea I had was to move the includes around so that the include chain only pulls in from one point, the file where main() is. Seems intuitive that if a header is only included once, then there should not be multiple entry points for function signatures in that file. Also the relationship between how .h and .cpp files is handled in the compile process is beyond my skills at this point. Nick
Sep 06 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dfk1tp$qpo$1 digitaldaemon.com...
If the solution isn't apparent, the most reliable way to find out what is
going on is to make a copy of the project, and then start deleting parts
of
it until what triggers the error becomes obvious.
That's the simplified version of what I did: Just did without the
namespace
 keyword for now, then got back to where I was;

 Linker error: Previous Definition Different

 Figured out how to run:
 Digital Mars Librarian Version 8.00n

 But that did not resolve the problem because I couldn't read the assembly
 listing - The guard def's method seems to be the only way to work on this,
but I
 may be misunderstanding #pragma once and the idea I had was to move the
includes
 around so that the include chain only pulls in from one point, the file
where
 main() is.

 Seems intuitive that if a header is only included once, then there should
not be
 multiple entry points for function signatures in that file. Also the
 relationship between how .h and .cpp files is handled in the compile
process is
 beyond my skills at this point.
If the project still is #include'ing files, then it hasn't been cut down to the minimum. It may seem unhelpful, but I really really recommend reducing your project to the minimum, and I mean the minimum, that reproduces the problem. This takes the guesswork out of what might be going wrong.
Sep 06 2005
parent Nicholas Jordan <Nicholas_member pathlink.com> writes:
In article <dfkkbm$1dru$1 digitaldaemon.com>, Walter Bright says...
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dfk1tp$qpo$1 digitaldaemon.com...
...
If the project still is #include'ing files, then it hasn't been cut down to
the minimum. It may seem unhelpful, but I really really recommend reducing
your project to the minimum, and I mean the minimum, that reproduces the
problem. This takes the guesswork out of what might be going wrong.
I pretty much did this - be though it may the some compile runs report processing of some 70,000 lines ( 0 error builds often ) the namespace issue continues ... I had stripped out everything from methods.cpp that was not essesntial building blocks for my toolkit and gotten to fast, clean builds except for the number not representable in limits.h I later tried putting the namespace feature back in and got the same error: in someheader.h: namespace the { int func(char in_, size_t len_) { ..... } } in somefile.cpp: int ret_val = the::func(); Compiler gives same error - semicolon expected. I can write a really bare-bones hello-yokel that doesn't include anything - as the compiler author, you are the authority on the matter. I understand unique about my setup can have quite a range of shades and implicatons, but I got an editor mangles source using the class editor a few hours ago, and was careful to go look at it using Textpad before anything faded away. Is this/these editors really primitive ? I haven't gotten to the skills of writing an editor, so this is a straight-up question. Nick
Sep 11 2005
prev sibling parent Nicholas Jordan <Nicholas_member pathlink.com> writes:
In article <dfgem7$b86$1 digitaldaemon.com>, Walter Bright says...
"Nicholas Jordan" <Nicholas_member pathlink.com> wrote in message
news:dfg0lh$18v$1 digitaldaemon.com...
 In the output window when I transferred my hashing function.  Editor
problem not
 as pressing right now. Compiler asks for a semicolon after an opening
curley
 brace:   namespace the { [ same with several places in stl ] And also a
'number
 not representable'  Warning that I do not know how to fix.

 Got any suggestions ? I have no idea where to look to fathom these issues
If the solution isn't apparent, the most reliable way to find out what is going on is to make a copy of the project, and then start deleting parts of it until what triggers the error becomes obvious.
Obvious was that I had more work to do before bothering more accomplished people; Following is work done 4am to 10 am this morning and taken into work machine for posting: --------lenghty post--------- Got to the point of L:\out\exe\itc.EXE built: Lines Processed: 51784 Errors: 0 Warnings: 0 'Successful build' - in the output window by tinkering and reading html docs, but don't really know what I did (or didn't do) that got me to this point. prob chmod as discussed in docs Per plan, I will beef out my toolkit of func()'s, replacing code that generated errors earlier and figure out test harnesses that will look for likely fail points; but to do this, I will need to understand the Compiler & Tools universe in much greater detail. Don't mean to be pesky, but numerous details await clarification: What does the line: ren L:\out\exe\$SCW$.EXE itc.EXE mean ? What is new.h doing showing up in my project window ? Did I put in there by accident ? Should itc.lib be added to the project using project/edit dialog ? It is intended to be a library of funcs()'s for future use in builds and projects ... needs to be automatically rebuilt anytime the object files it is built from are updated. What is -o+time on the command line to sc ? file://J:\dm\html\ctg\sc.html#dasho gives speed as an optimization, but does not say anything about this op Conceptual view of static keyword: This means file scope or :: ? Seems to vary more by which book one is reading than by implementation. It is consequential to my project design whether an outer scope variable is in the Global - all over the place - namespace or is restricted to file scope. Also, not totally disrelated in my thinking, the fact that a file (as a compilation unit) is sometimes called a translation unit in cs discussions has nothing to do with the TLB ? Safety controls that are obvious to me for a commercial grade product could be implemented in a robust manner if there is a powerful, speed-intensive frame of operation available for use between keystrokes of the user. Such things as Horstmann's Safe STL become useful tools for templating run-time checks that could [ ... could ... ] exit the program in a controlled manner with a record if some small probability failure mode was not accounted for in coding. <em>Page faults would affect this design paramater.</em> If I know that my entire operating universe is, by project design, 'Win32 Console Application' can I eliminate the #ifdef _WINIO bracketed source code in main() ? (I did already and it seems to work, too many issues for me to be guessing here) Issue of sizeof(unsigned long) v. sizeof(unsigned int): _ultoa() - but no uitoa() // unsigned int to ascii function in the standard library - is this correct ? Obviously _ultoa(static_cast<unsigned long>(value),...) But this builds into all efforts the morass of fixing thousands of lines code later to arise at some distant, unforseen point in the future: Fun to contemplate but not productive if this effort leads to large-scale projects. What is Write Block in the drop-down menu ? There seems to be no equivilent to ctl-tab command to tab through the Z-ordering of viewable editor spaces common to Win32 editors ... this command keyspace is occupied by 'go to next error'... correct ? RVO; do it like this: bool func(void* inVal = 0) { bool ret_val(inVal); .. return ret_val; } NOT: (???) bool func(void* inVal = 0) { { { { bool ret_val(inVal);// deeply nested declaration of ret_val } } } return ret_val; } In dm\html\ctg\sc.html (Friday, October 22, 2004 2:35:26 AM) (up late that night, huh Walter ?) line 1103: </dl></dl> <pre> The preformatted tag has no matching </pre> from there to eof - the closest </pre> is at line 989 before it. I do not know how to use the <dl>tag</dl> let alone the intended construct<dl><dl></dl></dl>
Sep 10 2005