Re: Is this valid C statement?
From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 09/27/04
- Next message: Dan Pop: "Re: Max Path [Newbie]"
- Previous message: Dan Pop: "Re: Embedded systems and C programming"
- In reply to: Joona I Palaste: "Re: Is this valid C statement?"
- Next in thread: Joona I Palaste: "Re: Is this valid C statement?"
- Reply: Joona I Palaste: "Re: Is this valid C statement?"
- Reply: John Harrison: "Re: Is this valid C statement?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Sep 2004 14:59:37 GMT
In <cj8pl7$6vd$1@oravannahka.helsinki.fi> Joona I Palaste <palaste@cc.helsinki.fi> writes:
>s.subbarayan <s_subbarayan@rediffmail.com> scribbled the following:
>> Dear all,
>> According to standards is this valid:
>
>> char TmpPtrWriteBuffer[1000];
>> void* PtrWriteBuffer =(void*) TmpPtrWriteBuffer;
>
>> I had a debate with my colleagues that anything cant be typecasted to
>> void* though the reverse is true.But they said this is valid.
>> I just can't agree with them with out a valid explaination.Can any C
>> standard experts clarify me this?
>
>You are right on this one. A pointer to anything can be assigned into a
>void *, even without a cast. ^^^^^^^^
You are wrong on this one. Pointers to functions cannot be converted
(either explicitly or implicitly) to pointers to void (and vice versa).
Undefined behaviour due to lack of specification in the standard.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
Currently looking for a job in the European Union
- Next message: Dan Pop: "Re: Max Path [Newbie]"
- Previous message: Dan Pop: "Re: Embedded systems and C programming"
- In reply to: Joona I Palaste: "Re: Is this valid C statement?"
- Next in thread: Joona I Palaste: "Re: Is this valid C statement?"
- Reply: Joona I Palaste: "Re: Is this valid C statement?"
- Reply: John Harrison: "Re: Is this valid C statement?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|