httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk-Willem van Gulik <dirk.vangu...@jrc.it>
Subject Re: [Fwd: Problem 2534]
Date Mon, 03 Aug 1998 17:40:08 GMT


On Mon, 3 Aug 1998, Marc Slemko wrote:

> On Mon, 3 Aug 1998, Jens-Uwe Mager wrote:
> 
> > But I would suspect that they would probably point to some ANSI
> > standard and say the compiler can do with constant string adresses what
> > it likes, there is no way that a user program could rely on particular
> > addresses.
> > 
> 
> If they can point to some standard saying that doing:
> 
> 	char foo[] = "this is a string"
...
Be carefull when having the same constant twice;

I believe that according to the ANSI standard (page 91)
if I read it correctly a compiler _may_

	char foo[] = "hello";
 	char some[] = "one";
	char bar[] = "hello";

end up having foo == bar. Or even if you are unlucky

	char foo[] = "hello world";
	char bar[] = "world";

can lead to foo+6 == bar. When working with Acorn's compile this sort of
entertainment could give hours of fun; as the compile would not complain
loudly when you did a bar = "indian" and ended up with a foo == "hello
indian". :-(.

Dw.



Mime
View raw message