gnokii-users
[Top][All Lists]
Advanced

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

Re: sprintf usage


From: E. Rosten
Subject: Re: sprintf usage
Date: Fri, 5 May 2006 17:05:45 +0100 (BST)

Hi,

There seems to be a problem with gnokii sources and some compilers. I
got the report from FC4 and gcc version 4.0.2 20051125. The problem is
with interpretation of:
sprintf(buffer, "%s%d", buffer, digit);

It used to work so far but under FC4 it behaves always in the was as
buffer was empty (regardles of buffer contents) and the result string
is always the digit.

What is the expected benaviour? Is it essentially appending %d digit to the end of the buffer.

Is it a bug in gcc or is it misuse of sprintf?

These things tend to be quite ill specified in the standard, so I would expect that it is a misuse. The bast place to ask is probably comp.lang.c.moderated

Also, wouldn't it be better to use snprintf as a general rule?

-Ed





reply via email to

[Prev in Thread] Current Thread [Next in Thread]