DragonFly users List (threaded) for 2006-05
Re: [OT] C pointers: BSD versus Linux?
:Hi compiler/OS gurus,
:Please consider this trivial fragment of c code which I've
:written in two different styles:
:My puzzle is this: on *BSD these two different styles work
:identically -- but on my linux boxes Style 1 produces a
:run-time error, while Style 2 works as expected.
:Anyone here know why this difference?
:Thanks for any clues!
Well, the first bit of code is illegal. The 't' pointer has to point
to something. e.g.:
time_t *t = &blah;
With that fixed, both styles work fine under either Linux or BSD. You
do have to #include <time.h>, of course.