// and \ (was Re: Software maintenance)

On 9/21/2010 3:52 PM, Seebs wrote:
On 2010-09-21, Keith Thompson<kst-u@xxxxxxx> wrote:
Seebs<usenet-nospam@xxxxxxxxx> writes:
I have never seen \ at end of line used by anything but mechanical
code processors.

I think you're forgetting about multi-line macro definitions.

You're right, obviously I am.

And I've even seen comments used in them. Although I think always
/**/ comments.

I don't think I've ever used comments _within_ a multi-line macro definition.

But, my mind comes up with all sorts of weird "what if" questions when reading threads such as this, even though I would probably never use code like this...

What does the standard say of "\" at the end of a line with a "//" comment? My compiler gives a warning, but "continues" the comment onto the next line:

char *pt = "This is a line" // comment \
"(foo)" \

I get this warning twice:

single-line comment contains line-continuation character

and the string contains "This is a line(baz)".

Ditto for gcc (with "-Wall"), though the warning is worded

warning: multiline `//' comment

I know that compilers are allowed to give any "warnings" that they like (for example, "warning: 'int i;' is cliche" would be perfectly legal), but "inquiring minds want to know".

Kenneth Brody

Relevant Pages

  • Re: Does file exist ?
    ... >compiler or unrelible result. ... But it is still good to keep in mind. ... >for warning. ... Well the trouble with it is, that one is highly likely to box up a ...
  • Re: How would you design Cs replacement?
    ... I wouldn't mind too much if the compiler give a warning ... Keith Thompson kst-u@xxxxxxx ...
  • Re: How would you design Cs replacement?
    ... I wouldn't mind too much if the compiler give a warning ... Don't your unit tests fail? ...
  • UrgentHelpPlease:accessing the memory and variables of the running function
    ... Please help if any clue comes to your mind. ... I have a program which is running for several days and it is written as a matlab function. ... But now a warning is appeared in the command line as follows: ... Consider storing this variable in HDF5 file format. ...
  • Re: Help! Major Memory Installation Issue
    ... same thing I had done once and hot-swapped some memory. ... professional tech can do that - mind you, I don't know if he did this ... means I have no warning ...