[OT] C pointers: BSD versus Linux?

Brian Reichert reichert at numachi.com
Wed May 31 13:00:00 PDT 2006


On Wed, May 31, 2006 at 12:44:07PM -0700, walt wrote:
> Hi compiler/OS gurus,
> 
> Please consider this trivial fragment of c code which I've
> written in two different styles:
> 
> Style 1:
> time_t t*;
> time(t);
> 
> Style 2:
> time_t t;
> time(&t);
> 
> 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.

What is the run-time error?

Which version(s) of gcc are at play?

In style 1, at what point are you allocating memory for t?

I suspect you're seeing a segfault...

> 
> Anyone here know why this difference?
> 
> Thanks for any clues!

-- 
Brian Reichert				<reichert at xxxxxxxxxxx>
55 Crystal Ave. #286			Daytime number: (603) 434-6842
Derry NH 03038-1725 USA			BSD admin/developer at large	





More information about the Users mailing list