Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

wxString::Printf()

<< < (3/3)

sethjackson:

--- Quote from: Ceniza on June 11, 2006, 12:52:51 am ---
--- Code: (cpp) ---#include <stdio.h>

int main()
{
  printf("%s %d %g", 1, 2);
  return 0;
}
--- End code ---


--- Quote from: gcc -Wall test.c -o test.exe ---test.c: In function `main':
test.c:5: warning: format argument is not a pointer (arg 2)
test.c:5: warning: too few arguments for format
--- End quote ---

--- End quote ---

Cool  8) I didn't know GCC checked that. I always use -Wall, but I never use printf so that is probably why I missed it...... Anyways I stand corrected. :)

Balazs:
Thanks Ceniza! :)

Game_Ender:
Very cool, I didn't know GCC did that check with printf.  Is that a general variage argument function check or is it just something special for the printf function?  If it is a special printf check, then it probably doesn't work with wxString::Printf.  Don't get me wrong, I like the printf syntax I just don't like the unsafeness (Looks to be a little miss placed with GCC+printf) of variable argument functions.  Boost.format (supports stand printf syntax, and positional arguments) of course solves both the type safety and translation issues, but at a 50% to 80% drop in performance.

thomas:
It works for gcc builtin variadic functions, such as [fs]?(print|scan)f, and it does confirmedly not work with wxString::Printf - we have seen it crash and burn many times in the past.

sethjackson:

--- Quote from: thomas on June 12, 2006, 11:20:03 pm ---It works for gcc builtin variadic functions, such as [fs]?(print|scan)f, and it does confirmedly not work with wxString::Printf - we have seen it crash and burn many times in the past.

--- End quote ---

Cool 8) Too bad it doesn't work for wxString::Printf()

Anyways I don't like printf(), or wxString::Printf() (I never use them). I love the << operator. :D


 

Navigation

[0] Message Index

[*] Previous page

Go to full version