Strings in C (Re: ambiguous ?)

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Oct 28 03:48:13 AEST 1989


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
>used to indicate byte-counted strings. P stands for "pascal".
>Was X3J11 aware of this? Or are the Mac compiler vendors going to change?

Yes, at least some of us were quite aware of this.  There are also other
nonstandard vendor extensions to fprintf() format specs in existence.
I've argued numerous times with C implementors that using %p for "Pascal"
(counted) strings encouraged non-portable programming.  Unfortunately
Apple's ToolBox interfaces are designed for Pascal, not C; the same malady
later showed up on the Apple IIGS.  There are better solutions, though,
such as providing Pascal-to-C string translator functions in the C library.
Note that ByteWorks' ORCA/C for the Apple IIGS will remain non-compliant
with the C Standard unless Mike Westerfield reverses his decision about
this.  (ORCA/C does provide conversion functions, so %p=>Pascal is not
really necessary.)

I have no idea whether or not the Mac compilers will ever become Standard
conforming.  From what I hear, most of them come nowhere close to
providing a full hosted implementation.



More information about the Comp.lang.c mailing list