This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help restricting args of an intrinsic function


On Monday, February 2, 2004, at 04:35 PM, Daniel Jacobowitz wrote: 
>  const int ci = 5;
>  int a1[ci];
> will not compile, because ci is not an integral constant-expression. 

Mike Stump wrote:
> Does anyone know why the above isn't supported in C? Certainly
> the obviousness of it escapes me. My inclination is to fix the
> standard, not the compiler.

  In C, the keyword "const" means "not modifyed by the C", but it has to
 be a real variable - in case it is modifyed by the program loader or
 linker (for instance in assembler) before the C program starts.
  The C standard should have defined the real constant:
inline const int size_of_array = 5;
  but someone forgot.
  I could also have replaced a lot of #define and #if/#ifdef by C
 constructs, like "inline const struct { ...; } configuration;".

  A dreamer...


	

	
		
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]