getchar_unlocked in windows undeclared

后端 未结 3 1030
广开言路
广开言路 2021-01-03 06:11

Here is my code:

#include 

void scan(int* i)
{
    int t=0;
    char c;
    bool negative=false;
    c=getchar_unlocked();
    while(c<\'0         


        
3条回答
  •  情歌与酒
    2021-01-03 06:51

    Windows have the equivalent, _getchar_nolock, it is Windows specific.

    See this link:

    https://msdn.microsoft.com/en-us/library/4y2e9z0c.aspx

    So if you are happy with a non-threadsafe version and you want the best possible performance you could do something like this:

    #ifdef WIN32
    // no getchar_unlocked on Windows so call _getchar_nolock
    inline int getchar_unlocked() { return _getchar_nolock(); }
    #endif
    

提交回复
热议问题