Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Problem with C compiler?
@ 1996-08-28  4:00 Scott Kramer
  1996-08-29  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  1996-08-30  4:00 ` Marc Roussel
  0 siblings, 2 replies; 4+ messages in thread
From: Scott Kramer @ 1996-08-28  4:00 UTC (permalink / raw)



greetings,

   I am converting some programs from my old s5v4 system to my
alphaserver 400.  I am not able to compile the same source code on
the alpha.  I keep getting a segmentation fault when using the time()
function.  I have looked at the cc documentation over and over and
can see no reason why this will not work.  I moved this source to my
AIX 3.2.5 system and It compiled and worked fine.  I am at a loss.
Please forgive me if this is a simple question, but it is annoying.

long *tloc;
time(tloc);

Other functions such as srand seem to have a problem with the pointer
tloc?

Any thoughts are Appreciated!

Scott Kramer


+++----------------------------------------+++-----------------------+++
| SCOTT A. KRAMER  SYSTEMS PROGRAMMER      | Email Address: ZSAKSAK@   |
| Anne Arundel Community College           | AACCI.AACC.CC.MD.US       |
| 101 College Parkway                      |                           |
| Arnold Md 21012                          | Telephone  410-541-2800   |
|------------------------------------------|---------------------------|
|  VM/ESA 2.2 ESA MODE - VSE/ESA 1.3.6     | MUSIC/SP 4.1 - CICS 2.2   |
+++----------------------------------------+++-----------------------+++



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem with C compiler?
  1996-08-28  4:00 Problem with C compiler? Scott Kramer
@ 1996-08-29  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
  1996-08-29  4:00   ` Tim Mooney
  1996-08-30  4:00 ` Marc Roussel
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 1996-08-29  4:00 UTC (permalink / raw)




In article <28AUG96.13550198.0011@AACCI.AACC.CC.MD.US>, Scott Kramer <ZSAKSAK@AACCI.AACC.CC.MD.US> writes:

>I moved this source to my
>AIX 3.2.5 system and It compiled and worked fine.  I am at a loss.
>Please forgive me if this is a simple question, but it is annoying.
>
>long *tloc;
>time(tloc);

You're lucky it worked there.  A pointer has to point AT something.
A bare pointer could be pointing anywhere.  On some system it may
be some random place in the virtual address of the process, just
some random place or no place.  Try something like:

long *tloc, clock ;

tloc = &clock ;

time(tloc) ;

Or:

long clock ;

time(&clock) ;

--
Alan Rollow				alan@nabeth.cxo.dec.com




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem with C compiler?
  1996-08-29  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
@ 1996-08-29  4:00   ` Tim Mooney
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Mooney @ 1996-08-29  4:00 UTC (permalink / raw)



In article <504f8i$ecg@nntpd2.cxo.dec.com>,
Alan Rollow - Dr. File System's Home for Wayward Inodes. <alan@nabeth.cxo.dec.com> wrote:
> 
> Try something like:
> 
> long *tloc, clock ;

While he's at it, that should be

	time_t *tloc, clock;

sizeof(time_t) != sizeof(long), at least under Digital Unix.

Tim
-- 
Tim Mooney                              mooney@toons.cc.ndsu.NoDak.edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J1, IACC Bldg.                 (701) 231-8541 (FAX)
North Dakota State University, Fargo, ND 58105



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem with C compiler?
  1996-08-28  4:00 Problem with C compiler? Scott Kramer
  1996-08-29  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
@ 1996-08-30  4:00 ` Marc Roussel
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Roussel @ 1996-08-30  4:00 UTC (permalink / raw)



Scott Kramer wrote:
> I keep getting a segmentation fault when using the time()
> function.  I have looked at the cc documentation over and over and
> can see no reason why this will not work.
> 
> long *tloc;
> time(tloc);

Your code is nonportable.  Read the time(3) man page.  tloc should be
pointer-to-time_t and time_t is defined in time.h.  As it happens,
time_t is not a long but an int on the alpha.

					Marc R. Roussel
					(roussel@henri.chem.uleth.ca)
					Department of Chemistry
					University of Lethbridge



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-08-30  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-08-28  4:00 Problem with C compiler? Scott Kramer
1996-08-29  4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
1996-08-29  4:00   ` Tim Mooney
1996-08-30  4:00 ` Marc Roussel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox