Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #103400

Re: Error message for a dangling pointer

From Manfred <noname@invalid.add>
Newsgroups comp.lang.c
Subject Re: Error message for a dangling pointer
Date 2017-02-07 19:09 +0100
Organization Aioe.org NNTP Server
Message-ID <o7d2gv$lrs$1@gioia.aioe.org> (permalink)
References <dangling-pointers-20170207022252@ram.dialup.fu-berlin.de> <1btw8654l6.fsf@pfeifferfamily.net> <o7d0tl$iis$2@gioia.aioe.org> <UB-20170207185259@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 2/7/2017 6:56 PM, Stefan Ram wrote:
> Manfred <noname@invalid.add> writes:
>> Maybe a dangling pointer assigned (and lost) in a function call could be
>> more explicit than with inner braces?
>> Eventually overwriting the stack frame with a second function call?
>
>   One important aspect of undefined behavior is:
>
>       * it might do what one naïvely expects.
>
>   The participiants of my community education center courses
>   need to see this. Otherwise, after the course they might see
>   that a program does what they expect and might think that
>   its all wrong what I told them because the program does what
>   they expect to instead of doing "something undefined".
>
>   I do not want to mangle reality by artificially forcing the
>   program to fulfill the (naïve?) meta-expectation that UB does
>   something else than naïvely expected.
>
I didn't try it, so this was just speculation, anyway it could probably 
do what you seem to be asking:
- trigger a more clear compiler error/warning
- result in the naive behaviour (if you do /not/ overwrite the stack frame)
- result in an unexpected (for the naive) result (if you /do/ overwrite 
the stack frame)

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Error message for a dangling pointer Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-07 09:49 -0700
  Re: Error message for a dangling pointer Manfred <noname@invalid.add> - 2017-02-07 18:42 +0100
    Re: Error message for a dangling pointer Manfred <noname@invalid.add> - 2017-02-07 19:09 +0100
    Re: Error message for a dangling pointer Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-07 21:20 -0700

csiph-web