[TUHS] // comment in C++

Nemo cym224 at gmail.com
Fri Feb 10 12:46:25 AEST 2017


On 9 February 2017 at 20:58, Dave Horsfall <dave at horsfall.org> wrote:
> On Thu, 9 Feb 2017, Dan Cross wrote:
>
>> Well, it wasn't in c89, but it's been part of ANSI C since 1999: almost 20
>> years!
>
> Not in my C book 2nd ed. (ANSI), it isn't...
>
>     A2.2 Comments
>
>     The characters /* introduce a comment, which terminates with the
>     characters */.  Comments do not not nest, and they do not occur within
>     string or character literals.
>
> There is no mention of "//"; I have the 51st printing, August 2013.

Hhmmm... I do not have ANSI C99 (or C11) but ISO/IEC 9899:TC3 states
(in Para. 6.4.9):

Except within a character constant, a string literal, or a comment,
the characters //
introduce a comment that includes all multibyte characters up to, but
not including, the
next new-line character.

N.


>
> --
> Dave Horsfall DTM (VK2KFU)  "Those who don't understand security will suffer."


More information about the TUHS mailing list