What's best to revamp the list than a funny Asterisk bug (if idiocy counts as 
a bug)? :)

Asterisk 1.2 introduced a version.h header with a couple of #defines that 
seemed to be what was needed to finally be able to write multi-version 
modules.

Ok, let's give them a look:

#define ASTERISK_VERSION "1.2.5"
#define ASTERISK_VERSION_NUM 010205

The former is a string... okay, fine...

The latter one supposes to be an integer, encoding the version number, to be 
used, for example, for:

#if ASTERISK_VERSION_NUM < 010205
...
#endif

But that leading zero is quite suspect.
Few use octal integers everyday, but in C, numbers prefixed with a zero are 
just that, octal constants.

Uhm... ok... it's an octal constant... 3 bits for each digit... sounds fine... 
BUT...

What happens when you want to encode 1.2.8 ?

#define ASTERISK_VERSION "1.2.8"
#define ASTERISK_VERSION_NUM 010208

Ohoh... that's NOT a valid octal constant... tada... every module using that 
preprocessor symbol does not compile anymore :)

So... that symbol is useless... if you use it your code won't compile on 
1.2.8, 1.2.9, 1.4.8, 1.4.9 and so on.

VERY smart! :)

Bye,

-- 
  Daniele "Vihai" Orlandi
  Espia S.r.l.
_______________________________________________
Visdn-hackers mailing list
[email protected]
https://mailman.uli.it/mailman/listinfo/visdn-hackers

Reply via email to