DragonFly BSD
DragonFly users List (threaded) for 2006-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [OT] C pointers: BSD versus Linux?


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Thu, 1 Jun 2006 00:01:14 +0200

On 31.05.2006, at 20:37, jwatson@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
Description: This is a digitally signed message part



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]