[comp.sys.amiga] Troubles with Manx

flynn@oscvax.UUCP (09/21/87)

I am currently working on porting a program over from a PDP 11 to the Amiga.
I am using Manx 3.40a with what I believe is all of the patchs.

THE PROBLEM
  I seem to be having some trouble with my global variables and returning 
functions.  In one case I have a function which returns a simple integer.
lets call it foo, if i check the value i right before the return and
then print the returned value they do not match, (in fact the returned
value is garbage)
i.e.

extern int foo();

main()
  {
  int i;
  .
  .
  .
  i = foo();
  printf("%d\n", i);  /* this prints some funny number */
  .
  .
  .
  }

int foo() 
  {
  int j;

  j = 10;
  printf("%d\n", j);  /* works fine  */
  return(j);
  } 

Another problem I have is where I have a global array of integers.
say:
int foo[] = {15, 10, 12, 12};

main()
  {
  int i;
  .
  .
  i = foo[1];
  .
  }
in some routines I get the correct answer but in other routines I get 
a completely incorrect answer (i.e. big number).

When I compile I used cc with no flags, but I have also tried using the
+D +C and +Q in different quanitities.

Any suggestions?

And while we are on the subject of Manx bugs.  I jhave found that when
I use macros in Z 1.2 it crashes
for example, if I am doing a search and replace with the sequence:
/foo
:>n3sbar
100v
it will do x replaces and then crash.

AND FINALLY!
  since I am taking up net time anyways I would just like to say thanks
to everyone on the net for teaching me so much, and giving me so much.
(That includes all the neat freebie/shareware software).  I would list
names but I think there are to many of you guys out there.

THANKS
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-
Flynn D. Fishman, Esquire

Ontario Science Centre, Toronto
...!{allegra,ihnp4,decvax,pyramid}!utzoo!oscvax!flynn
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-

peter@sugar.UUCP (Peter da Silva) (09/25/87)

In article <515@oscvax.UUCP>, flynn@oscvax.UUCP (Flynn D. Fishman) writes:
>   I seem to be having some trouble with my global variables..

Are you sure that you're using the right library memory model? If you use
short ints with long-int printf you'll get weird stack effects.

> And while we are on the subject of Manx bugs.  I jhave found that when
> I use macros in Z 1.2 it crashes

I thought 3.40a came with Z 2.2. Z 2.2 crashes if you typeahead before
it sets the window modes (a quick fix for which would be to print
a string just before switching modes, so any typeahead would hang it up),
but I've had no problems with macros.
-- 
-- Peter da Silva `-_-' ...!hoptoad!academ!uhnix1!sugar!peter
--                 'U`  Have you hugged your wolf today?
-- Disclaimer: These aren't mere opinions... these are *values*.