diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html index f40a1ff1f..fb34a3ad9 100644 --- a/Doc/Manual/Varargs.html +++ b/Doc/Manual/Varargs.html @@ -270,21 +270,37 @@ traceprintf(arg1, NULL);

Arguably, this approach seems to defeat the whole point of variable length arguments. However, -this actually provides enough support for many simple kinds of varargs functions to still be useful. For -instance, you could make function calls like this (in Python): +this actually provides enough support for many simple kinds of varargs functions to still be useful, however it does come with a caveat. +For instance, you could make function calls like this (in Python):

 >>> traceprintf("Hello World")
 >>> traceprintf("Hello %s. Your number is %d\n" % (name, num))
+>>> traceprintf("Your result is 90%%.")
 

Notice how string formatting is being done in Python instead of C. +The caveat is the strings passed must be safe to use in C though. +For example if name was to contain a "%" it should be double escaped in order to avoid unpredictable +behaviour:

+
+
+>>> traceprintf("Your result is 90%.\n")  # unpredictable behaviour
+>>> traceprintf("Your result is 90%%.\n") # good
+
+
+ +

+Read on for further solutions. +

+ +

13.4 Argument replacement using %varargs