Mail Archives: djgpp/1996/05/20/21:17:51
In article <4nlke7$aka AT news1 DOT goodnet DOT com> snarfy AT goodnet DOT com writes:
>
> Here is an interesting 'bug' that I have found in cwsdpmi. When I compile
> the attached file and run it under dos, it blows up giving me a SIGSEGV, but
> it works correctly under a windows dos box and in linux dosemu. Here
> is the program:
>
> #include <stdio.h>
>
> typedef struct {
> int x;
> int y;
> } foo;
>
> foo *bar;
> void main()
> {
> bar->x = 3;
> bar->y = 4;
> printf("x = %d\n", bar->x);
> }
>
>
> As you can see, there isn't much to this program, and I have compiled
> programs that are a lot more complex than this with the exact same
> system setup with no problems.
Ever tried allocating memory for your structs? Where do you think bar
points to? Are you kicking yourself yet? :-)
oh and void main(); is bad. Use main(); or int main();
..splitbung
--
* TQ 1.0 * The 'Just So Quotes'.
OLTION'S COMPLETE, UNABRIDGED HISTORY OF THE UNIVERSE
Bang! ...crumple.
-- Jery Oltion
- Raw text -