Re: Compile Error C1017 With sizeof()
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Wed, 10 May 2006 00:12:57 -0500
On Wed, 10 May 2006 00:54:46 -0400, "Alexander J. Oss" <alex@xxxxxxxxxxx>
wrote:
Visual Studio 2005 Standard is giving me "fatal error C1017: invalid integer
constant expression" on code that compiles fine in Borland land:
#if sizeof(char)==1
The standard says:
(5.19.1) ...An integral constant-expression can involve only ... and sizeof
expressions.
and
(5.3.3.1) sizeof(char), sizeof(signed char) and sizeof(unsigned char) are 1
That last quote from the standard makes it clear that my code is pretty
useless, since by the standard I'll never have any other case. However,
this shouldn't cause a compilation error, should it?
It should, since sizeof isn't part of the preprocessor language. And you're
right, sizeof(char) is 1 by definition. In C and C++ terms, "char" and
"byte" are synonymous, and they don't necessarily imply 8 bits, though
usually they do.
--
Doug Harrison
Visual C++ MVP
.
- 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
- Compile Error C1017 With sizeof()
- Prev by Date: Stop Giving Me All Those Errors!
- Next by Date: Re: Stop Giving Me All Those Errors!
- Previous by thread: Compile Error C1017 With sizeof()
- Next by thread: Re: Compile Error C1017 With sizeof()
- Index(es):
Relevant Pages
|
Loading