Date: Fri, 24 Sep 1999 15:24:49 -0400 (EDT) From: Zhihui Zhang <zzhang@cs.binghamton.edu> To: freebsd-questions@freebsd.org Subject: A program that causes "bus error" Message-ID: <Pine.GSO.3.96.990924151823.23327A-100000@sol.cs.binghamton.edu>
next in thread | raw e-mail | index | archive | help
The following program causes "bus error" on a Sun workstation whether I compile it with cc or gcc: #include <stdio.h> main() { union { char a[10]; int i; } u; int * p = (int *) &(u.a[1]); * p = 17; printf("%d\n", *p); } However, it works fine (print out 17) on FreeBSD 3.2. Can anyone explain the difference for me? Thanks a lot. -------------------------------------------------- Zhihui Zhang. Please visit http://www.freebsd.org -------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.3.96.990924151823.23327A-100000>