[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: menu.lst problem



In <[🔎] 4A731C61.3080007@symantec.com>, Bob McGowan wrote:
>Boyd Stephen Smith Jr. wrote:
>> 3. Lines starting with a single '#' are comments in C *unless* the '#'
>> is immediately followed by a pre-processor command.  This is similar --
>> you can think of update-grub as a GRUB menu.lst pre-processor.
>
>The sharp/hash symbol is a preprocessor indicator.  "Pure" C has never
>supported anything other than '/*...*/' for comments.  C++ added the
>single line comment marker '//' (double forward slash).

From the latest C standard:
6.10 Preprocessing directives
Syntax
preprocessing-file:
	groupopt
group:
	group-part
	group group-part
group-part:
	if-section
	control-line
	text-line
	# non-directive
[...]
A text line shall not begin with a # preprocessing token. A non-directive 
shall not begin with any of the directive names appearing in the syntax.

>It is possible to use the preprocessor to do weird and wonderful,
>things, so I believe you could even have it ignore lines beginning with
>a hash mark, effectively treating them as comments, but that is
>definitely not "normal".

From what I can tell, there's no additional requirements on the 
implementation for what to do with non-directives, but traditional C 
compilers would ignore them -- effectively making them comments.  Since the 
standard doesn't specify what to do with them, any behavior is acceptable.

I agree that they are not standard comments and are not accepted by your C 
compiler, which might be conforming.  (FWIW, I don't believe gcc is 
completely conforming.)
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: