top/contents search

16. Strange Problems

16.1 Why is this loop always executing once?

	for(i = start; i < end; i++);
		printf("%d\n", i);

16.1b I'm getting baffling syntax errors which make no sense at all, and it seems like large chunks of my program aren't being compiled.

16.1c Why isn't my procedure call working? The compiler seems to skip right over it.

16.2 I'm getting strange syntax errors on the very first declaration in a file, but it looks fine.

16.3 This program crashes before it even runs! (When single-stepping with a debugger, it dies before the first statement in main.)

16.4 I have a program that seems to run correctly, but it crashes as it's exiting, after the last statement in main(). What could be causing this?

16.5 This program runs perfectly on one machine, but I get weird results on another. Stranger still, adding or removing a debugging printout changes the symptoms...

16.6 Why does this code:

char *p = "hello, world!";
p[0] = 'H';


I've got some code that's trying to unpack external structures, but it's crashing with a message about an ``unaligned access.'' What does this mean? The code looks like this:

struct mystruct {
	char c;
	long int i32;
	int i16;
} s;

char buf[7], *p;
fread(buf, 7, 1, fp);
p = buf;
s.c = *p++;
s.i32 = *(long int *)p;
p += 4;
s.i16 = *(int *)p;

16.8 What do ``Segmentation violation'', ``Bus error'', and ``General protection fault'' mean? What's a ``core dump''?


contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North