delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/05/10/21:57:45

Date: Mon, 10 May 93 19:53:33 EDT
From: james AT bellhow (James Schettine)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: GNU C user needs help with djgpp.

	Original From: Timothy Wilson <wilsont AT rahul DOT net>

	[ stuff deleted... ]

	2. Lots of Memory segmentation errors. 
	My 4 Meg ST has no problems what so ever running my code. I copy the 
	source directly over to my clone (386SX-16, 4 Megs) and it craps out when i
	access certain parts of my program. 
	(and no, its not hardware specific code, its all standard C)

	What gives? Am i wrong in the assumption that djgpp has a truly flat memory
	model? (ie, whats the catch). 

	Please help me conquer this wretched clone. 

	Thank you!

The ST (680x0) and SUNs (680x0 and sparc) use a different byte order from Intel
which can cause some interesting late nite debugging sessions.

Obvious ( documented ) things to watch out for are 'C' structures transfered via
network or written to disk.  Alignment, padding, and internal representation
become issues.

More subtle are errors in the code which are hidden by the "big-endian" machines.
The only ST code I ever ported was a ray-tracer which contained:
	newstr = malloc( strlen( oldstr ) );
The allocation is one-too-small but went undiscovered because ints and pointers
usually start with a zero byte.

Hope some of this helps.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019