Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.sprintlink.net!howland.reston.ans.net!Germany.EU.net!Dortmund.Germany.EU.net!interface-business.de!not-for-mail From: j@interface-business.de (J Wunsch) Newsgroups: comp.unix.bsd.bsdi.misc Subject: Re: Programming problem with BSDI cc complier: Incompat. pointer types char * != u_char * Date: 29 Sep 1995 14:16:06 +0100 Organization: interface business GmbH, Dresden Lines: 32 Message-ID: <44grim$is@ida.interface-business.de> References: <ramoore.16.000DB171@lamp0.arl.mil> NNTP-Posting-Host: ida.interface-business.de Randy Moore <ramoore@lamp0.arl.mil> wrote: >If any BSDI unix programmer out there could bail me out, it would be much >appreciated. Well, i'm not a BSDI unix programmer... let's try: >I am trying to compile some software (that I did not write) on a BSDI v 2.0.1 >system. The software compiles, but I get several warnings that I am using >Incompatible pointer types on lines that use the 'strlen' command. The >software defines the pointer as type 'u_char *' while the man page for strlen >says that it wants to see type 'const char *. Passing a non-const pointer type to a function expecting a const pointer type is always possible and not worth a warning. The "const" simply means that the function itself will not change the object pointed to. Passing an unsigned char pointer to a function expecting a char pointer is indeed a type mismatch in a pedantic interpretation of the standard. However, this one is unlikely to cause any harm as long as all functions involved are dealing with actual character strings. However, there's normally no good reason to declare characters that are being used in its native purpose (smalles IO item) as "unsigned". The distinction between signed und unsigned is only useful when treating the "char"s as small integers. If it's really only happening on callse to str*() functions, the warning is benign. -- J"org Wunsch Unix support engineer joerg_wunsch@interface-business.de [private: http://www.sax.de/~joerg/]