Re: Supressing a %d parameter in a string



I actually expected to get an error, so I tried it with gcc last night:

  printf( "arg %2$d, arg %3$d\n", 1, 2, 3 );

gcc didn't even feel a need to warn me.

I didn't try getting any of the gettext tools to accept it.  If they won't, we may want to consider whether it should be possible to tell them to treat it as a warning rather than an error.  I wouldn't make that the default behavior.  It is almost always an error to omit a parameter.  However, it would be nice to be able to override it when necessary.

- Dale


----- Original Message -----
From: Åsmund Skjæveland <aasmunds fys uio no>
Date: Friday, February 25, 2005 7:30 am
Subject: Re: Supressing a %d parameter in a string

> > When you are using the numbered version of the formatting 
> parameters, 
> > you should just be able to leave out the ones that you don't 
> want.  Does 
> > that parameter ever have any other value besides 1 for that message?
> 
> No, you can't. If you leave out parameter#1 and use parameter#2, 
> you get
> an error.
> 
> -- 
> Åsmund Skjæveland <aasmunds fys uio no>
> 
> _______________________________________________
> gnome-i18n mailing list
> gnome-i18n gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-i18n
>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]