C legitimacy?? 
Author Message
 C legitimacy??


Quote:

> > Huh?  I thought expressions such as:

> >   sizeof "Foo"

> > were allowed as integer constant expressions...

> Yes, that's an exception.

.... because sizeof is actually done by the preprocessor, and
after the preprocessor gets done, it _is_ an integer constant.

--

Coffee should be black as hell, strong as death and sweet as love.
                                     -Turkish proverb
--



Wed, 02 Apr 2003 08:27:46 GMT  
 C legitimacy??

Quote:




> > > Huh?  I thought expressions such as:

> > >   sizeof "Foo"

> > > were allowed as integer constant expressions...

> > Yes, that's an exception.

> .... because sizeof is actually done by the preprocessor, and
> after the preprocessor gets done, it _is_ an integer constant.

Hmm?  The preprocessor knows nothing of sizeof.
--



Wed, 02 Apr 2003 08:37:06 GMT  
 C legitimacy??

Quote:




> > > Huh?  I thought expressions such as:

> > >   sizeof "Foo"

> > > were allowed as integer constant expressions...

> > Yes, that's an exception.

> .... because sizeof is actually done by the preprocessor, and
> after the preprocessor gets done, it _is_ an integer constant.

No it isn't.  sizeof is evaluated at compile time, but in a
phase that is (logically) after preprocessing.

By (logically) I mean that the standard specifies that
a given source file is processed in a number of logical
phases (although an implementation is allowed to merge
phases, the end result in terms of <say> behaviour of a
running program is required to be the same as if the
phases had been followed in the specified order).
--



Fri, 04 Apr 2003 03:00:00 GMT  
 
 [ 18 post ]  Go to page: [1] [2]

 Relevant Pages 
 

 
Powered by phpBB® Forum Software