Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Marjamrob1

macrumors regular
Original poster
Jul 19, 2012
114
0
When reading an older development book, I found this:

You may also hear multi-line comments being described as 'C-Style' comments because the /*...*/ is the only one available for creating comments in the C language.

However I have written C programs, that use "//" single line comments.
 

ytk

macrumors 6502
Jul 8, 2010
252
5
Originally, the only style for commenting in C was /* ... */. This is still the case in C89, which is traditionally known as ANSI-C. C99 added support for one line comments using //. If your book was written before the C99 standard was approved, it was correct at the time, and still is for older systems.
 

Marjamrob1

macrumors regular
Original poster
Jul 19, 2012
114
0
Ok, thank you, I understand now. I haven't actually ever used anything besides C99
 

chown33

Moderator
Staff member
Aug 9, 2009
10,731
8,407
A sea of green
C++ when it was invented in 78 at Bell, or C++98

Why does it matter?


There was a period of time when the C compilers used by Apple accepted // comments even though it wasn't in the ANSI/ISO C standard of the time. There was a command-line option for strict C conformance that would turn this off, so // was forbidden. IIRC, there was another option that would force strict compliance to the ISO C standard, EXCEPT that // comments were allowed. Other than as a historical footnote, none of this matters today, and hasn't since C99.
 

Marjamrob1

macrumors regular
Original poster
Jul 19, 2012
114
0
Why does it matter?


There was a period of time when the C compilers used by Apple accepted // comments even though it wasn't in the ANSI/ISO C standard of the time. There was a command-line option for strict C conformance that would turn this off, so // was forbidden. IIRC, there was another option that would force strict compliance to the ISO C standard, EXCEPT that // comments were allowed. Other than as a historical footnote, none of this matters today, and hasn't since C99.

I was just curious but thank you.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.