// 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)" \
"(bar)"
"(baz)";

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 ...
    (microsoft.public.vb.general.discussion)
  • Re: How would you design Cs replacement?
    ... I wouldn't mind too much if the compiler give a warning ... Keith Thompson kst-u@xxxxxxx ...
    (comp.lang.c)
  • 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? ...
    (comp.lang.c)
  • 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 ...
    (alt.comp.periphs.mainboard.asus)
  • need urgen help please
    ... 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. ...
    (comp.soft-sys.matlab)