|
Re: [patch #5704] Data New/Open/Save: msg#00062statistics.pspp.devel
On Tue, Jan 23, 2007 at 04:22:14PM -0800, Ben Pfaff wrote: > an alternative approach would be to implement a > special conversion specification within the > create_syntax_string_source function. Then we could simply write > something like: > > create_syntax_string_source ("EXPORT OUTFILE=%q.", de->file_name); > > This way, there's no need for the caller to worry about buffers or > dealloction at all. Yes, that's a good idea. However, I'd propose a slightly different syntax: create_syntax_string_source ("EXPORT OUTFILE=%sq.", de->file_name); If you make the full specification %sq, then you can still get GCC to check that a "char *" argument is present by telling it that it's a printf-like function. There'd need to be a suffix character for unquoted strings too, e.g. %su, but all in all the slight inconvenience of using 2-character conversions is vastly outweighed (in my opinion) by having compile-time checking. > I remember coming across a sprintf like function which allows you to > specify custom conversions, but I can't remember where I found it. There's a variety of them, and glibc even includes one of its own, but they're not hard to write yourself, especially if you don't need the full generality of printf (and I doubt we do). OK. So there's a number of issues to think about. If you're agreeable, I'll commit this patch as is, and file a bug about the quoting, so we can deal with it as a seperate issue. J' -- PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://pgp.mit.edu or any PGP keyserver for public key.
pspp-dev mailing list pspp-dev@xxxxxxx http://lists.gnu.org/mailman/listinfo/pspp-dev |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [patch #5704] Data New/Open/Save: 00062, Ben Pfaff |
|---|---|
| Next by Date: | Re: [patch #5704] Data New/Open/Save: 00062, Ben Pfaff |
| Previous by Thread: | Re: [patch #5704] Data New/Open/Savei: 00062, Ben Pfaff |
| Next by Thread: | Re: [patch #5704] Data New/Open/Save: 00062, Ben Pfaff |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |