Sujet : Re: Running an editor from ANSI C
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 06. Jun 2024, 20:54:57
Autres entêtes
Organisation : None to speak of
Message-ID : <87o78dzw1a.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
David Brown <
david.brown@hesbynett.no> writes:
On 06/06/2024 10:27, Malcolm McLean wrote:
It does work. But my compiler warns about rmpnam() being deprecated.
>
I presume you mean "tmpnam()" here. No, it has not been deprecated -
not even in C23. I could be wrong, but this sounds like one of MSVC's
arbitrary self-declared deprecations, using scare tactics to encourage
people to use MSVC's own functions rather than standard C functions,
thus locking you into their tools and platform.
[...]
You're right, tmpnam() is not deprecated either by ISO C or by POSIX.
But tmpfile() is likely to be better for most purposes. It creates a
file and returns a FILE*. tmpnam() returns a string pointer, and it's
possible that some other process could create a file with the same name
before the caller has a chance to create it.
(mkstemp() is more flexible, but is not defined by ISO C.)
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */