httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: [Fwd: Problem 2534]
Date Mon, 03 Aug 1998 22:40:31 GMT
Dirk-Willem van Gulik wrote:
> 
> 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". :-(.

Maybe a strcpy(bar,"indian") would do that, but even so, IMO the
compiler is broken. But there's no way even a broken compiler could do
what you describe, surely?

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686| Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org/
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author     http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache/

WE'RE RECRUITING! http://www.aldigital.co.uk/recruit/

Mime
View raw message