home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18840 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.9 KB  |  45 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!mcsun!hp4at!paul
  3. From: paul@hp4at.eunet.co.at (Paul Gillingwater)
  4. Subject: va_arg() with Zortech's C++ compiler strangeness
  5. Message-ID: <1992Dec23.220033.13666@hp4at.eunet.co.at>
  6. Organization: EUnet EDV Dienstleistungs GmbH A-1010 Wien Austria
  7. Date: Wed, 23 Dec 1992 22:00:33 GMT
  8. Lines: 35
  9.  
  10. I'm using Zortech's C++ compiler version 2.1, although this segment of 
  11. code is written in C.  I seem to get a syntax error when I change from 
  12. the default (small) memory model, to the C (compact) memory model.
  13.  
  14. ztc -I.. -mc -b -p -c -DDOS -DANSI _VSSCANF
  15. ztc1b -I.. -mc -p -DDOS -DANSI -oC:\WINDOWS\TMP\ztc_JC7.tmp _VSSCANF
  16.                 char_ptr = va_arg (arg_ptr, char far*);
  17.                                                     ^
  18. "_VSSCANF.c", line 132 Syntax error: lvalue expected
  19.                 char_ptr = va_arg (arg_ptr, char *);
  20.                                                  ^
  21. "_VSSCANF.c", line 194 Syntax error: lvalue expected
  22.  
  23. As you can see, I tried changing the pointer to a far pointer, which I 
  24. is necessary to access objects outside the 64kb data segment.  I under-
  25. stand that the C model supports a 64 kb code space and a 1 Mb data space.
  26. This code compiles just fine when compiled using S (small) model.
  27. BTW, the code is taken from the PDCurses library, which was posted to
  28. comp.sources.misc this month.  I have it mostly working with the Zortech
  29. compiler, except for delay_output() and this memory model.
  30.  
  31. This code segment then uses va_arg, which is a macro defined thus in 
  32. stdarg.h:
  33.  
  34. #define va_arg(ap,type)    (*((type __ss *)(ap))++)
  35.  
  36. As you can see, the macro uses a type of __ss *.  I tried this, with
  37. the same result.  Is this due to my limited understanding of variable
  38. argument macro implementations, or something flakey in Zortech's compiler?
  39.  
  40. Please mail responses to me, as I don't have much time to read posts,
  41. and I'll summarize if there is interest.
  42. -- 
  43. Paul Gillingwater
  44. Home system: paul@actrix.co.at (Waffle)
  45.