|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: marco (slash
arbornet.org)Date: Tue Feb 05 2002 - 19:43:05 CST
Well, I am surprised it does not core dump on solaris.
You might want to consider to assign the pointer or allocate some memory
for it.
struct point pt;
p = &pt;
or
p = malloc(sizeof(point));
I bet it tries to assign #13 to $0.
/marco
----- Original Message -----
From: "Marc Xander Makkes" <xander
kr85.org>
To: <misc
openbsd.org>
Sent: Tuesday, February 05, 2002 6:48 PM
Subject: Why the hell is my code coredumping ?
> I have this little code;
>
> +----
>
>
> #include <stdio.h>
>
> struct point { int x; int y;};
> int main()
> {
> struct point *p;
> p->y = 13;
> printf("%d\n", p->y);
> }
>
>
> ----+
>
> it compiles and runs ok on solaris, and it compiles ok on openbsd but
> when i run it, it directly core dumpes. Is there something i forgot to
> read or is it the 13?:)
>
> The code is compiled on 2 differend OpenBSD 3.0 machines, one with
GENERIC
> and one modified, both i386.
>
>
> any clues ?
>
> Kind regards,
>
>
> MX
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]