Danny Smith wrote:
> In stdlib.h we have
> /*
> * NOTE: Officially the three following functions are obsolete. The Win32 API
> * functions SetErrorMode, Beep and Sleep are their replacements.
> */
> _CRTIMP void __cdecl _beep (unsigned int, unsigned int);
> _CRTIMP void __cdecl _seterrormode (int);
> _CRTIMP void __cdecl _sleep (unsigned long);
>
>
> and no oldname prototypes. The oldname aliases for these functions are
> not documented by MSDN. (Nor could I find any recent doc's on the
> underscored names, although they do show up in example code.)
>
> The oldnames, however, _are_ in libmoldname.a There presence in this
> system lib lets some configure scripts to believe that these symbols are
> okay to use. This is a particular problem with sleep, since the msvcrt
> version of _sleep want milliseconds, not seconds, as is usual on most
> systems. An example of this is libgfortan.a which detects sleep, warns
> about implicit prototype and then uses it as if it were sleep'ing secs.
>
> I think we should remove these oldnames from libmoldnames. Any objections.
>
> Danny
I think `_sleep' etc. should be kept but `sleep' etc. should be removed.
I am also wondering whether we should add a UNIX-like `sleep'. This idea
is attractive, and some Win32 compilers (like Digital Mars) already
provides such a function (but DMC does not provide `_sleep'). However,
if (old) MSVC compatibility is to be kept, and `_sleep' is to be
retained, then a `sleep' having different semantics from `_sleep' might
be confusing. So....
Best regards,
Yongwei
|