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

271 Views Asked by At

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?

1

There are 1 best solutions below

1
On

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.