[comp.databases] Informix 4gl C language interface broken/inconsistent

jw@pan.UUCP (Jamie Watson) (09/19/88)

The Informix 4gl language contains only two integer data types, smallint
and integer.  However, the C functions for interfacing with 4gl contain
three routines for popping integer types off the stack, popshort(),
popint() and poplong().  There is no indication in the documentation of
the difference between popint() and poplong(), nor of which should be
used with the Informix 'integer' type.  It turns out that using popint()
works, as long as the passed value is 32767 or less.  Trying to pass a
value of 32768 or more, and using popint(), produces 4 lines of error
text on the display - but everything still works correctly.  This small
program illustrates the failure:

main
  define
    i integer

  let i = 32767
  call c_sub(i)
  let i = 65000
  call c_sub(i)
end main

c_sub (n) {
  int i;
  if (n != 1) {
    printf ("Wrong args\n");
  }
  popint(&i);
  printf ("%d\n", i);
}

Change to poplong() and the error message goes away.

jw