You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Hudson <gh...@MIT.EDU> on 2003/12/08 15:44:55 UTC
Re: Unsupported printf positional parameters on Windows [was: Re:
Resolution: only print specific error message when present]
On Mon, 2003-12-08 at 09:41, Julian Foad wrote:
> Branko Čibej wrote:
> >
> > I'm much more concerned about the nightmare of unsupported printf
> > positional parameters on Windows...
>
> Huh? Care to state briefly (but less briefly) what you mean by that, so I can at least try to avoid the problem when writing portable code?
I'm not sure which aspect you need an explanation of, so I'll explain
everything I know.
Let's say our code had
printf(_("String '%s' has %d characters\n"), s, strlen(s));
An acceptable German translation might be (according to the gnu awk
manual):
"%d Zeichen lang ist die Zeichenkette '%s'\n"
... but the arguments are in the wrong order. (I don't know any German;
maybe you could make the arguments be in the right order by rewording
the sentence, but assume that in many cases you can't.) So, folks added
support in printf for:
"%2$d Zeichen lang ist die Ziechenkette '%1$s'\n"
Apparently, Windows doesn't have this support. But I don't see why that
matters; we almost exclusively use apr_psprintf. There doesn't appear
to be positional argument support in apr_vformatter(), but that's not a
Windows-specific problem, and we can presumably fix it with enough work.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Unsupported printf positional parameters on Windows [was: Re: Resolution: only print specific error message when present]
Posted by Paul Smith <pa...@nortelnetworks.com>.
%% Julian Foad <ju...@btopenworld.com> writes:
>> "%2$d Zeichen lang ist die Ziechenkette '%1$s'\n"
>> Apparently, Windows doesn't have this support.
jf> Nor does standard C, so you can't rely on any platform having
jf> support for this.
Although not required by ISO C (yet?), they _are_ required by POSIX
standards. FYI.
--
-------------------------------------------------------------------------------
Paul D. Smith <ps...@nortelnetworks.com> HASMAT--HA Software Mthds & Tools
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Unsupported printf positional parameters on Windows [was: Re:
Resolution: only print specific error message when present]
Posted by Julian Foad <ju...@btopenworld.com>.
Greg Hudson wrote:
> On Mon, 2003-12-08 at 09:41, Julian Foad wrote:
>
>>Branko Čibej wrote:
>>
>>>I'm much more concerned about the nightmare of unsupported printf
>>>positional parameters on Windows...
>>
>>Huh? Care to state briefly (but less briefly) what you mean by that, so I can at least try to avoid the problem when writing portable code?
>
> I'm not sure which aspect you need an explanation of, so I'll explain
> everything I know.
Thanks; I didn't know what you meant by "printf positional parameters" because I had never come across them.
> "%2$d Zeichen lang ist die Ziechenkette '%1$s'\n"
>
> Apparently, Windows doesn't have this support.
Nor does standard C, so you can't rely on any platform having support for this.
> But I don't see why that
> matters; we almost exclusively use apr_psprintf. There doesn't appear
> to be positional argument support in apr_vformatter(), but that's not a
> Windows-specific problem, and we can presumably fix it with enough work.
Yes, OK, I suppose we could implement them in APR.
It certainly sounds like a useful feature for this purpose.
- Julian
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Unsupported printf positional parameters on Windows [was: Re:Resolution:
only print specific error message when present]
Posted by Branko Čibej <br...@xbc.nu>.
Kevin Pilch-Bisson wrote:
>Windows FormatMessage(...) does support positional parameters.
>
>
Yes, brrrr, I was trying not to think about that horror. Mix "portable"
and "FormatMessage" in the same thought, and watch your brain explode. :-)
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
RE: Unsupported printf positional parameters on Windows [was: Re:Resolution: only print specific error message when present]
Posted by Kevin Pilch-Bisson <ke...@pilch-bisson.net>.
> -----Original Message-----
> From: Greg Hudson [mailto:ghudson@MIT.EDU]
> Sent: Monday, December 08, 2003 7:45 AM
> To: Julian Foad
> Cc: dev@subversion.tigris.org
> Subject: Re: Unsupported printf positional parameters on Windows [was:
> Re:Resolution: only print specific error message when present]
>
> On Mon, 2003-12-08 at 09:41, Julian Foad wrote:
> > Branko Čibej wrote:
> > >
> > > I'm much more concerned about the nightmare of unsupported printf
> > > positional parameters on Windows...
> >
> > Huh? Care to state briefly (but less briefly) what you mean by that, so
> I can at least try to avoid the problem when writing portable code?
>
> I'm not sure which aspect you need an explanation of, so I'll explain
> everything I know.
>
> Let's say our code had
>
> printf(_("String '%s' has %d characters\n"), s, strlen(s));
>
> An acceptable German translation might be (according to the gnu awk
> manual):
>
> "%d Zeichen lang ist die Zeichenkette '%s'\n"
>
> ... but the arguments are in the wrong order. (I don't know any German;
> maybe you could make the arguments be in the right order by rewording
> the sentence, but assume that in many cases you can't.) So, folks added
> support in printf for:
>
> "%2$d Zeichen lang ist die Ziechenkette '%1$s'\n"
>
> Apparently, Windows doesn't have this support. But I don't see why that
> matters; we almost exclusively use apr_psprintf. There doesn't appear
> to be positional argument support in apr_vformatter(), but that's not a
> Windows-specific problem, and we can presumably fix it with enough work.
Windows FormatMessage(...) does support positional parameters.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/
formatmessage.asp
But I agree that this would be a good thing to add to apr_vformatter.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org