Mail Archives: djgpp/1997/03/06/04:50:00
On 5 Mar 1997, George Foot wrote:
> Paul Derbyshire (ao950 AT FreeNet DOT Carleton DOT CA) wrote:
>
>
> : I have never explicitly cast a malloc pointer when assigning it. Even with
> : my usual -Wall -Werror it never causes any complaint from gcc.
>
> : Are you sure this is non-ansi?
>
> : mypointer=malloc(size);
>
> I'm not sure what the standard says for C programs, but for C++ programs it
> is definitely not allowed - try it. I was under the impression that ANSI C
> was basically ANSI C++ without classes; clearly I'm wrong.
>
> --
> George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
> Merton College, Oxford.
>
>
... perhaps you should remember that C++ is a *strongly* typed language -
C is not, so Paul's assigning of a void pointer to a whatever-pointer is
actually allowed, as long as the compiler has a chance to know how to
convert void * to whatever *.
In other words: C != (C++)--
;-)
Thomas
--
Thomas Knudsen | www: http://www.gfy.ku.dk/~tk/
National Survey and Cadastre - Denmark | e-mail: tk AT gfy DOT ku DOT dk
Geodetic office, Rentemestervej 8 | Direct Phone: +45 35 87 52 55
DK-2400 Copenhagen NV, Denmark | FAX: +45 35 87 50 52
- Raw text -