views:

47

answers:

2

I'm relatively new to C, and am curious what this syntax means in a function declaration:

int DEFAULT_CC foo(void)

where DEFAULT_CC is probably defined somewhere else as:

#define DEFAULT_CC      "something"

(I realized the previous example I had up had to do with something completely irrelevant).

+2  A: 

More likely calling convention. A calling convention defines exactly how values are passed to and returned from a function. Typical values might be cdecl or stdcall. For a comprehensive explanation of x86 conventions, see Wikipedia.

int "cc" foo(void)

wouldn't compile.

Matthew Flaschen
For example:http://www.sfr-fresh.com/linux/misc/xrdp-0.4.1.tar.gz:a/xrdp-0.4.1/common/arch.h
Dipstick
Awesome, thanks! I got the second line of code (with the "cc") from something I googled, and not the original project, so that probably was something different someone was using the same name for.
humoeba
A: 

Maybe you're messing up C code with makefile notation, because DEFAULT_CC is the standard makefile variable for setting default C compiler.

Pmod
In what make? In [GNU make](http://www.gnu.org/software/autoconf/manual/make/Catalogue-of-Rules.html), that's `CC`.
Matthew Flaschen
Actually, found it in imake and in mkdep sources. I was wrong stating it as standard makefile variable. Anyway it's very likely that #define DEFAULT_CC "cc" is taken from sources of make related tool.
Pmod