Re: why is casting malloc a bad thing?
From: Michael Wojcik (mwojcik_at_newsguy.com)
Date: 01/26/04
- Next message: Barry Schwarz: "Re: Call to free() sefaults"
- Previous message: Emmanuel Delahaye: "Re: about sizeof(char)"
- In reply to: P.J. Plauger: "Re: why is casting malloc a bad thing?"
- Next in thread: Mark McIntyre: "Re: why is casting malloc a bad thing?"
- Reply: Mark McIntyre: "Re: why is casting malloc a bad thing?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Jan 2004 21:11:41 GMT
In article <hqEQb.4916$qA4.1039@nwrddc01.gnilink.net>, "P.J. Plauger" <pjp@dinkumware.com> writes:
> "Mark McIntyre" <markmcintyre@spamcop.net> wrote in message
> news:svq510hmo8tlllf4she80nd170peljhdkv@4ax.com...
>
> > On Sat, 24 Jan 2004 19:00:24 GMT, in comp.lang.c , "P.J. Plauger"
> > <pjp@dinkumware.com> wrote:
> >
> > >"Jack Klein" <jackklein@spamcop.net> wrote in message
> > >news:c2e510h9hbjao7qn7uo5v4h3c7kgipak6s@4ax.com...
> > >
> > >> > warning: invalid conversion from `void*' to `double*'
> > >>
> > >> This is comp.lang.c, there is no such thing as an invalid conversion
> > >> from void* to double*. The conversion is implicit and correct.
> > >
> > > If the alignment is incorrect the conversion is invalid.
> >
> > But its impossible for it to be incorrect. The C Standard says so. If
> > your h/w platform can't guarantee it, then you can't implement C
> > there.
>
> Next step after nonsense -- bullshit. See 6.3.2.3, para. 7.
I suspect Mark thought you were claiming that a (non-null) void *
value *returned by malloc* could point to an area that was
incorrectly aligned for double. Of course a void * value obtained
another way (from the address of a pointer to a different type, or
from an uninitialized automatic void* variable, and so forth) may
point to such an area, and assigning such a value to a double* would
be invalid.
I also suspect Mark did not recognize your name, or he might have
double-checked before posting.
Of course, my suspicions may be ill-founded.
-- Michael Wojcik michael.wojcik@microfocus.com Do not "test" parts, as this may compromise sensitive joinery. Those who suffer difficulty should abandon the enterprise immediately. -- Chris Ware
- Next message: Barry Schwarz: "Re: Call to free() sefaults"
- Previous message: Emmanuel Delahaye: "Re: about sizeof(char)"
- In reply to: P.J. Plauger: "Re: why is casting malloc a bad thing?"
- Next in thread: Mark McIntyre: "Re: why is casting malloc a bad thing?"
- Reply: Mark McIntyre: "Re: why is casting malloc a bad thing?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|