[comp.sys.mac.programmer] Linking Problem with ThinkC

bjb@pyramid.com (Bruce Beare) (06/07/91)

I just noticed the following behaviour with ThinkC....


file1....
---------
#include "structures.h"
Defaults gdefaults = {1,2,3};


file2....
----------
#include "structures.h"
Defaults *gdefaults;

void whatever(void)
{
  somewhere = gdefaults->anything;
}

___________________________________________

I was tracking down an elusive bug where 'somewhere' wouldn't get 
properly initialized. When I put a breakpoint at the assignment
line and then used the data window to look at gdefaults, the
data window told me that gdefaults was a zero-valued pointer (a
dead giveaway).

Sure -- this IS a typical stupid programming bug, but I would have
expected the linker to give me some warning. 


-Bruce
bjb@pyramid.com