[linux-audio-dev] newest audio server for Linux (yep, yet another)

Tim Hockin thockin at hockin.org
Wed Feb 5 13:29:00 UTC 2003


> That is a great feature of C++ but PortAudio is using 'C' not C++. So I
> think our only choices are #define and enum. PortAudio uses both.

you can still use const variables - gcc with optimizations treats them like
defines, but with type-safety.

> Are enums better than #defines?? I am always trying to improve my 'C' chops
> so I am open to suggestions.

If you can enumerate the values, you should, IMHO.  Of course, there are
times to break this, but in general YES.  An enum is a real type, and can be
used as such.

enum foo_cmd {
	FOO_A,
	FOO_B,
	FOO_C,
};
int doo_foo_cmd(enum foo_cmd cmd);


Tim



More information about the Linux-audio-dev mailing list