Re: [Lit.] Buffer overruns

From: BRG (brg_at_nowhere.org)
Date: 01/17/05


Date: Mon, 17 Jan 2005 07:58:03 +0000

infobahn wrote:

[snip]
> So in summary, I expect
>
> 100 4
> 4 4
> 100 4
>
> NOW I'll run it on my system...
>
> First, Borland:
>
> 100 100
> 4 4
> 100 100

[snip]

> This is not in line with my expectations. But all is not lost! Let's
> try gcc:

[snip]

> Here's the output:
>
> 100 4
> 4 4
> 100 4
>
> I conclude that Borland's compiler gives incorrect results! But
> gcc looks fine to me.

But is your conclusion correct? I have tried this with many compilers
and both results turn up frequently.

So we need Doug to tell us which is correct (maybe neither - is it
undefined behaviour?). Doug?

    Brian Gladman



Relevant Pages

  • Re: Confusion in ANSI Cs function concepts
    ... attempt to convert that int to a pointer. ... I speculate that you are running gcc in some kind of lenient mode. ... the compiler can proceed to generate code to do whatever it ... <snip other points> ...
    (comp.lang.c)
  • Re: Jaccuse
    ... you also sell educational licences. ... If the RedHat guys or the SuSE guys posted answers in here along ... with gcc (which is just as well, as it would have been off-topic ...
    (comp.lang.c)
  • Re: Switch() parsing insanity
    ... Gcc is right. ... snip ... ... Scopes of identifiers ... function scope. ...
    (comp.lang.c)
  • Re: question
    ... snip ... ... My compiler said nothing. ... Assuming you are using gcc, you should always use at least: ... Chuck F ...
    (comp.lang.c)
  • Re: A simple parser
    ... I believe this program is strictly conforming. ... If you want it to compile under gcc, ... What bug? ...
    (comp.lang.c)