[OT] C pointers: BSD versus Linux?
Simon 'corecode' Schubert
corecode at fs.ei.tum.de
Wed May 31 15:09:39 PDT 2006
On 31.05.2006, at 20:37, jwatson at xxxxxxxxxxxx wrote:
Style 1:
time_t t*;
time(t);
My experience is that *BSD's malloc and pointer stuff is designed to
be as
safe as possible by default, and will try to fix and correct any common
mistakes you will make. The short answer is that BSD will figure out
where you are screwing up and allow it to work. Linux gives you total
freedom to screw your self over.
I can not agree with this. BSD malloc() (or better: free()) is much
more conservative, and lately our default even changed to abort on
double free()s. A lot of buggy software has double free()s and I think
glibc doesn't even complain per default.
Also, style 1 is technically "incorrect" since you never allocated the
memory that t is pointing to before passing it into time().
maybe the compiler on BSD by chance put NULL into "t" and thus made it
a valid parameter?
cheers
simon
--
Serve - BSD +++ RENT this banner advert +++ ASCII Ribbon /"\
Work - Mac +++ space for low â¬â¬â¬ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
Attachment:
PGP.sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00000.pgp
Type: application/octet-stream
Size: 186 bytes
Desc: "Description: This is a digitally signed message part"
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20060531/545a028c/attachment-0021.obj>
More information about the Users
mailing list