Re: c question



=?ISO-8859-1?Q?=22Nils_O=2E_Sel=E5sdal=22?= <NOS@xxxxxxx> wrote:

Richard Bos wrote:
"shaanxxx" <shaanxxx@xxxxxxxxx> wrote:

girish.dinne@xxxxxxxxx wrote:
what value will be assigned for the following statement.

int i="hai";
"Hai" will return an address which will coverted to int and assigned to
i.

Please quote C&V in the Standard where this is guaranteed.

perhaps 6.3.2.3:6 in C99.

That only allows pointers to be converted to integers; it does not say
that the conversion occurs automatically, without a cast.

The result is implementation defined or undefined behaviour though.

Quite; so the result may not ever be assigned to i. UB means that it is
also allowed to simply crash.

Richard
.



Relevant Pages

  • Re: bug in visual studio .net 2003 - breakpoints and memcpy
    ... Posix is a standard too with no less (some would say ... > platforms that support the conversion. ... Conversion between code pointers to integers does not exist for the sole ...
    (microsoft.public.win32.programmer.kernel)
  • Re: ptr conversions and values
    ... That's why the standard explicitly ... > representation, without providing an explanation of what pairs of values are ... So I have given an explanation how to connect integers to pointers ... > won't have any more or any less issues than conversion does. ...
    (comp.std.c)
  • Re: Is this valid C statement?
    ... Pointers to functions cannot be converted ... >> Undefined behaviour due to lack of specification in the standard. ... Invoking undefined behaviour doesn't require any warning. ... the C standard does not define the conversion between void pointers and ...
    (comp.lang.c)
  • Re: Static _Bool initialization
    ... See 6.3.1.2 of C99. ... speaks about values, not pointers. ... I fail to see any conversion of pointers to ...
    (comp.std.c)
  • Re: POINTER_MAX and POINTER_MIN??
    ... Given that you know what they are when the pointer value is assigned, ... The conversion isn't "silly," because it is essential ... every integer to &stderr would satisfy the Standard. ... If you can't be sure you have a C99 compiler (the adoption ...
    (comp.lang.c)