[PATCH] do proper typecasting on malloc() and calloc() calls
Radoslaw Szkodzinski
astralstorm at gorzow.mm.pl
Mon Mar 20 23:06:03 UTC 2006
On Monday 20 March 2006 12:42, Johannes Stezenbach wrote yet:
> On Sun, Mar 19, 2006, TK Soh wrote:
> > do proper typecasting on malloc() and calloc() calls
s/proper/improper/
> > To support build on Solaris 2.6 using Sun Pro SC4.0 (C++ 4.1) compiler:
Why would anyone want to build C code with C++ compiler?
Lack of disc space? Fascist and stupid administrator?
> The description is wrong, as the type casts are not "proper", but
> superflous (according to C99 std).
This compiler is too old to support C99 properly anyway.
C89 compiler shouldn't require it too. If it does, throw away that piece of
sh*t and burn it.
> Could you please describe the problem which this patch is
> attempting to fix, and why these type casts make a
> difference with the Sun C compiler?
It's a C++ compiler, and some C++ compilers do a more strict (and IMO useless)
type checking on pointer assignment, so you can't assign void * to anything
else than void * unless you cast.
This is because C++ standard redefined the meaning of void *. A religious
issue, most likely to encourage use of static_cast<>.
--
GPG Key id: 0xD1F10BA2
Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2
AstralStorm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20060321/dc660d11/attachment-0001.asc>
More information about the Mercurial
mailing list