Re: Compile Error C1017 With sizeof()
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Wed, 10 May 2006 07:36:41 -0400
"Alexander J. Oss" <alex@xxxxxxxxxxx> wrote in message
news:e7yRTX$cGHA.4312@xxxxxxxxxxxxxxxxxxxx
The preprocessor language includes "constant-expression" (according to
16.1.1 and 16.1.3), and 5.19 is what defines an integral
"constant-expression", and that definition includes sizeof().
...ugh, I just found the following quote at
http://msdn2.microsoft.com/en-us/library/ew2hz0yd.aspx:
The expression cannot use sizeof or a type-cast operator.
Why is this quote present here but not in the C++ standard (that I
could find)?
16.1/1 The expression that controls conditional inclusion shall be an
integral constant expression except that: it shall not contain a cast;
identifiers (including those lexically identical to keywords) are
interpreted as described below;136) ...
16.1/3 ... After all replacements due to macro expansion and the defined
unary operator have been performed, all remaining identifiers and
keywords, except for true and false, are replaced with the pp-number
0...
136) Because the controlling constant expression is evaluated during
translation phase 4, all identifiers either are or are not macro names -
there simply are no keywords, enumeration constants, and so on.
That is, as far as preprocessor is concerned, sizeof(int) is the same as
0(0) , which is obviously nonsense.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: Compile Error C1017 With sizeof()
- From: Alexander J. Oss
- Re: Compile Error C1017 With sizeof()
- References:
- Compile Error C1017 With sizeof()
- From: Alexander J. Oss
- Re: Compile Error C1017 With sizeof()
- From: Doug Harrison [MVP]
- Re: Compile Error C1017 With sizeof()
- From: Alexander J. Oss
- Compile Error C1017 With sizeof()
- Prev by Date: Re: Compile Error C1017 With sizeof()
- Next by Date: Re: ActiveX function remove
- Previous by thread: Re: Compile Error C1017 With sizeof()
- Next by thread: Re: Compile Error C1017 With sizeof()
- Index(es):
Relevant Pages
|
Loading