TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: John Poltorak
from: Jonathan de Boyne Pollard
date: 1996-01-27 01:53:08
subject: C errors

JP>
  > w "jigsaw.h",L278/C18(#344): DosGetThreadInfo: Argument to
  > pragma is undefined.
  > w "jigsaw.h",L278/C18(#675): DosGetThreadInfo
  > |    Pragma argument must be a known function, function typedef, or variabl
JP>

  Cause : The sample code contains a `pragma linkage' directive
  referring to a name (DosGetThreadInfo) that has not yet been declared.

  Solution : Don't use `pragma linkage'.  Use a calling convention
  specifier, such as _System, on the function declaration and definition.

JP>
  > -- In passing an argument to parameter __s1 of type char *, function strcpy
  > w "jigsaw.c",L581/C11(#553): szWindowText
  > |    Conversion of type `UCHAR *' to type `char *' is not ANSI-compliant.
  > |    (See also type `UCHAR'
("E:\METAWARE\inc\os2\os2def.h",L92/C24)).
  > w "jigsaw.c",L582/C16(#553):
  > |    Conversion of type `char *' to type `PUCHAR'
  > ("E:\METAWARE\inc\os2\os2def.h",L129/C16) is not ANSI-
  > compliant.
  > w "jigsaw.c",L585/C19(#553):
  > |    Conversion of type `char *' to type `PUCHAR'
  > ("E:\METAWARE\inc\os2\os2def.h",L129/C16) is not ANSI-
  > compliant.
  > -- In passing an argument to parameter __s1 of type char *, function strcat
  > w "jigsaw.c",L591/C11(#553): szWindowText
  > |    Conversion of type `UCHAR *' to type `char *' is not ANSI-compliant.
  > |    (See also type `UCHAR'
("E:\METAWARE\inc\os2\os2def.h",L92/C24)).
JP>

  Cause : The messages are pretty much self explanatory.  UCHAR is
  *unsigned* char, and and implicit conversion to plain char is not
  Standard C (although the compiler will do it).

  Solution : Pass `char *' pointers to the Standard C str*() functions.

JP>
  > -- In passing an argument to parameter pszText of type
  > PCSZ, function WinSetWindowText:
  > E "jigsaw.c",L592/C33(#416): szWindowText
  > |    Type `UCHAR *' can't be converted to type `PCSZ'
  > ("E:\METAWARE\inc\os2\os2def.h",L110/C21).
  > |    (See also type `UCHAR'
("E:\METAWARE\inc\os2\os2def.h",L92/C24)).
JP>

  Cause : PCSZ is `const char *', whereas `UCHAR *' is `unsigned char
  *'.  An implicit conversion cannot convert from `unsigned char' to
  `char' *AND* add constness.

  Solution : Declare the buffer as `char' instead of `UCHAR'.

JP>
  > w "jigsaw.c",L804/C19(#257): '=' encountered where '==' may
  > have been intended.
  > w "jigsaw.c",L1877/C11(#257): '=' encountered where '=='
  > may have been intended.
  > w "jigsaw.c",L1883/C11(#257): '=' encountered where '=='
  > may have been intended.
JP>

  Cause : You have an assignment in the controlling expression of an
  `if', `while', or `for' statement.

  Solution : Many purists will hoist the assignment out of the
  expression.  Others simply ignore the warning.

JP>
  > Some of the errors above just seem like sloppy coding,
  > which shouldn't make it into production code suitable for
  > teaching...
JP>

  Many of the example programs from the OS/2 Developers Toolkit (such as
  this) appear to have been written by students working at IBM over
  their summer vacations.

  > JdeBP <
___
 X MegaMail 2.10 #0:
--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 440/4 141/209 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.