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

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


From: Brian Reichert <reichert@xxxxxxxxxxx>
Date: Wed, 31 May 2006 15:57:01 -0400

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@xxxxxxxxxxx>
55 Crystal Ave. #286			Daytime number: (603) 434-6842
Derry NH 03038-1725 USA			BSD admin/developer at large	



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