Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!cs.umn.edu!cybrspc!roy From: roy%cybrspc@cs.umn.edu (Roy M. Silvernail) Newsgroups: comp.lang.c Subject: Non-Portable pointer assignment? Message-ID: Date: 2 Jun 91 17:13:09 GMT Article-I.D.: cybrspc.mccX31w164w Organization: Villa CyberSpace, Minneapolis, MN Lines: 23 (no, this isn't compiler-specific :-) I use Turbo C, and sometimes get the warning "Non-portable pointer assignment" when I do something like this: foo(char *p) { char *q; q = strchr(p,'x'); /* this line gets complaints */ } TFM says strchr() returns pointer to char, and the pointer I'm assigning to is a pointer to char, so I'm in the dark. On my platform, the code works, but I try to write portably. So, what's the proper (perhaps the ANSI) way to handle such an assignment? If Turbo is right, this snip of code will fail on other machines or other compilers. -- Roy M. Silvernail -- roy%cybrspc@cs.umn.edu - OR- cybrspc!roy@cs.umn.edu perl -e '$x = 1/20; print "Just my \$$x! (adjusted for inflation)\n"' "What do you mean, you've never been to Alpha Centauri?" -- Prostetnic Vogon Jeltz