Strings in C (Re: ambiguous ?)

6600pete at ucsbuxa.ucsb.edu 6600pete at ucsbuxa.ucsb.edu
Sat Oct 28 09:55:15 AEST 1989


In article <11428 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
> In article <2742 at hub.UUCP> pete at cavevax.ucsb.edu writes:
>>In article <2421 at convex.UUCP> grogers at sushi.uucp (Geoffrey Rogers) writes:
>>> In article <6676 at ficc.uu.net> peter at ficc.uu.net (Peter da Silva) writes:
>>>>In most Macintosh C compilers that I've seen, the syntax !"%p...."! is
>>Actually, the syntax is "\p...", but that's only a nit I had to pick.
> Oh, if THAT's the issue, then it's not a problem.  Any program containing
> a  string literal like "\pXXX" has stepped into the Twilight Zone of
> "undefined behavior"; the implementation is free to assign a "counted
> string" meaning to this if it happens to be useful to do so.

Ick. What a mess this makes. Oh well.

Actually, from previous articles I've just read, there is apparently a
"%p...", but I'm not quite sure why this is a bad thing as long as it is
documented correctly. I mean, on a non-Mac compiler, it's not going to
be caught anyway.

And odds are that you're not going to want to port a truly Mac-ish app
anywhere. The first page of Inside Macintosh, the Macker's Bible, says
"Everything you know is wrong..." Porting TO the Mac is conceivable;
most compilers have relatively extensive "UNIX compatibility" libraries.
But code FROM UNIX is not going to have a problem with "\p..." or
"%p..." either, is it? The SunOS 4 man pages don't say they use "%p..."
for anything (which of course is not the final word, but we're dealing
in percentage chances of conflicts, aren't we?)
--
  | GurgleKat (Pete Gontier), pete at cavevax.ucsb.edu
  | .UUCP reply addresses bounce; try another path.
  | ...if you'd gone to Dartmouth, you'd not have had to take the math.



More information about the Comp.lang.c mailing list