[LLVMdev] How to identify LLVM version? [correction]

Csaba Raduly rcsaba at gmail.com
Fri Jun 3 02:18:58 PDT 2011


On Fri, Jun 3, 2011 at 9:19 AM, Joachim Durchholz  wrote:
> A minor point: Make that function parameter an enum instead of a
> boolean. That would make it possible to extend the function so it
> returns other information without potentially breaking client code
> (which might pass in 1 or -1 or something entirely different to get
> repository information).

Also, boolean parameters are bad for writing self-documenting code; compare

LLVMGetVersion(REPOSITORY_VERSION);

versus

LLVMGetVersion(true);

(in the second case, reading the caller code is not enough to
understand the intent).
See also

http://www.jroller.com/alexRuiz/entry/boolean_arguments_can_be_evil
http://blogs.msdn.com/b/oldnewthing/archive/2006/08/28/728349.aspx

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds



More information about the llvm-dev mailing list