>From [EMAIL PROTECTED] Thu Jun 21 15:39:03 2001

>On Thu, 21 Jun 2001 [EMAIL PROTECTED] wrote:
>> If you write functions that are named like the original ones, you may
>> get into problems with two points:
>>
>> 1)   other functions from libc may use implementation specific
>>      details and force to have both implementations probably
>>      working against each other or detroying data structures.

>That is exactly what's happening now with GCC 3.0 and your printf
>replacement... The implementation-specific details in the system's
>stdio.h conflict with your printf().

I don't need to include the apropriate definitions (only in the printf() source).

This is really no big problem. The nice fact is that printf() is well defined
and it really doesn't matter if the actual implementation differs in minor
details from the official definition.

>> If you name it differently, you may include the system's stdio too, but
>> then you may not call any of your functions the same as they are called in
>> stdio.h

>Well, the point was to avoid the system's stdio. Your printf
>implementation includes the system's stdio.h and provides a printf()
>implementation. So your code does not conform to the statement you
>just made.

Then you don't see the problem with replacing stdio in general.
There are global variables and hidden implementation details (specially
related to MT safe code) that may be used directly from libc internal functions
and cause problems. While you may solve these problems for a single OS, it
is far too much complexity if you like to do it in general.

If I add my own printf() there is no problem with global variables and no
problem buffering of stdout ... also no problem with hidden internals.
It makes no problem to have two printf() implementations at the same time.
They will just cooperate fine.




J�rg

 EMail:[EMAIL PROTECTED] (home) J�rg Schilling D-13353 Berlin
       [EMAIL PROTECTED]               (uni)  If you don't have iso-8859-1
       [EMAIL PROTECTED]           (work) chars I am J"org Schilling
 URL:  http://www.fokus.gmd.de/usr/schilling   ftp://ftp.fokus.gmd.de/pub/unix


--  
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to