Unix Programming - Re: multi-process programming: reading/writing a pipe

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2006 > Re: multi-process programming: reading/writing a pipe





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: multi-process programming: reading/writing a pipe
Alex Fraser

2006-03-19, 12:02 pm

"hierarchical_polymorphist" <hierarchicalpolymorphist@gmail.com> wrote in
message news:1142715181.503447.321040@g10g2000cwb.googlegroups.com...
> One more thing, I've seen many after many codes and books that actually
> cast the result of malloc(). (Apart from the point Alex made that
> failure to include <stdlib.h> will cause a compiler warning, but I
> actually included that in my original program. Well...in my case, this
> step is unnecessary, but in general, why isn't it a good practice to
> cast the return value from malloc?)


The main reason (in my opinion) is the undefined behaviour due to the
missing declaration. There is also the simple fact that the cast is not
necessary: you waste time typing it, and anyone who reads the code wastes
time processing the redundant cast.

Google turned up the following link, which from a quick scan looks worth a
read: http://www.cpax.org.uk/prg/writings/casting.php

Alex


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com