简体   繁体   中英

What does __ (two underscores) stand for in Hpux C program

I see the following code in HPUX C program:

   extern int fcntl __((int, int, ...));
   _LF_EXTERN int creat __((const char *, mode_t));

These lines are compiled using aCC.

Could somebody let me know the meaning of 2 underscores after fcntl and creat in the above code?

This is most likely a macro that enables the use of the header with old, pre-ANSI C compilers.
The "old style" C function declarations didn't include parameter types.

I suspect its definition looks somewhat like this

#ifdef __STDC__
#define __(params) params
#else
#define __(params) ()
#endif 

I believe type-safe function prototypes is one of the first language features that C adopted from C++.
And the fact that I remember this makes me feel very, very old.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM