最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c - do 'inp' and 'outp' have special meaning to MSVC compiler - Stack Overflow

programmeradmin1浏览0评论

Trying to compile portable c compiler on windows. Compiling some files I get this

C:\work\pcc-revived\pcc\cc\cpp\cpp.h(176): error C2365: 'outp': redefinition; previous definition was 'function'
C:\work\pcc-revived\pcc\cc\cpp\cpp.h(177): error C2365: 'inp': redefinition; previous definition was 'function'

For this. in .h file

typedef char usch;
extern char *pbeg;
extern char  *pend;
extern char *outp;
extern char *inp;

then in c file

pbeg = outp = inp = fb->buf;

I get

..\..\cc\cpp\cpp.c(408): warning C4047: '=': 'int (__cdecl *)()' differs in levels of indirection from 'usch *'
..\..\cc\cpp\cpp.c(408): error C2106: '=': left operand must be l-value

It seems to think that outp and inp are implicitly defined function calls - ie old style foo() without a declaration of foo, treating foo as int foo(void)

I grepped entire include trees of MSVC and windows SDK and cannot find the string outp and inp

I then ran 'cl /E' to get the preprocessor output, and compiled that output, same error (of course) but the string outp and inp do not occur anywhere in the file except for the places I showed above

If I change to outpx and inpx all works fine - confused

EDIT.

I made a very simple test

extern char * inp;
int x(){

  
    return 0;
}

this produces

test.c(1): error C2365: 'inp': redefinition; previous definition was 'function'

compiler

Microsoft (R) C/C++ Optimizing Compiler Version 19.38.33135 for x64

Trying to compile portable c compiler on windows. Compiling some files I get this

C:\work\pcc-revived\pcc\cc\cpp\cpp.h(176): error C2365: 'outp': redefinition; previous definition was 'function'
C:\work\pcc-revived\pcc\cc\cpp\cpp.h(177): error C2365: 'inp': redefinition; previous definition was 'function'

For this. in .h file

typedef char usch;
extern char *pbeg;
extern char  *pend;
extern char *outp;
extern char *inp;

then in c file

pbeg = outp = inp = fb->buf;

I get

..\..\cc\cpp\cpp.c(408): warning C4047: '=': 'int (__cdecl *)()' differs in levels of indirection from 'usch *'
..\..\cc\cpp\cpp.c(408): error C2106: '=': left operand must be l-value

It seems to think that outp and inp are implicitly defined function calls - ie old style foo() without a declaration of foo, treating foo as int foo(void)

I grepped entire include trees of MSVC and windows SDK and cannot find the string outp and inp

I then ran 'cl /E' to get the preprocessor output, and compiled that output, same error (of course) but the string outp and inp do not occur anywhere in the file except for the places I showed above

If I change to outpx and inpx all works fine - confused

EDIT.

I made a very simple test

extern char * inp;
int x(){

  
    return 0;
}

this produces

test.c(1): error C2365: 'inp': redefinition; previous definition was 'function'

compiler

Microsoft (R) C/C++ Optimizing Compiler Version 19.38.33135 for x64
Share Improve this question edited Feb 6 at 22:02 pm100 asked Feb 6 at 19:42 pm100pm100 50.2k24 gold badges92 silver badges152 bronze badges 13
  • @ikegami see edit – pm100 Commented Feb 6 at 21:38
  • What compiler version are you running? – dbush Commented Feb 6 at 21:48
  • @dbush Microsoft (R) C/C++ Optimizing Compiler Version 19.38.33135 for x64 – pm100 Commented Feb 6 at 21:49
  • wow! With your demo, the answer is obviously yes. What beyond that are you asking? – ikegami Commented Feb 6 at 22:07
  • 1 @Lundin odd that they are hardwired into the compiler, not header files – pm100 Commented Feb 8 at 0:28
 |  Show 8 more comments

1 Answer 1

Reset to default 1

It appears these are obsolete functions, removed as of MSVC 2015:

https://learn.microsoft.com/en-us/cpp/c-runtime-library/inp-inpw-inpd?view=msvc-170

https://learn.microsoft.com/en-us/cpp/c-runtime-library/outp-outpw-outpd?view=msvc-170

Important

These functions are obsolete. Beginning in Visual Studio 2015, they are not available in the CRT. This API can't be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported in Universal Windows Platform apps.

Given that nothing of these show up in headers, they most likely exist in the compiler itself as a warning that the functions were removed.

发布评论

评论列表(0)

  1. 暂无评论