14 April 2009

தமிழ் புத்தாண்டு நல்வாழ்த்துக்கள்

இந்த வருடம் முதல் தை முதல் தேதிதான் தமிழ் புத்தாண்டு. - வரலாற்றில் இடம் பெற துடிக்கும் கருணாநிதி

ஆனால் சித்திரை முதல் நாளும் அரசு விடுமுறை உண்டு. - வருடபிறப்பை மாற்றியது மக்களுக்கு தெரியாமல் அவர்களை பாதிக்காமல் பார்த்துக்கொள்ளும் கருணாநிதி

"சித்திரை முதல் நாள் சிறப்பு நிகழ்ச்சிகள்". - வருவாயை இழக்க விரும்பாத கலைஞர் தொலைக்காட்சி.

சன் டிவி: இரண்டு நாட்களுக்கு முன், "தமிழ் புத்தாண்டு சிறப்பு நிகழ்ச்சிகள்...". இன்று, "சன் தொலைக்காட்சி ஆண்டு விழா சிறப்பு நிகழ்ச்சிகள்..."

13 April 2009

ஒவ்வொரு செயலுக்கும் பலன் உண்டு - நியுட்டனின் மூன்றாம் விதி

ஒவ்வொரு செயலுக்கும் பலன் உண்டு

நம்மில் பலர் நாம் ஒரு விஷயம் நடந்தால் நன்றாக இருக்கும் என நினைத்தாலும், அது நடக்காது என நினைத்து நமக்கு பிடிக்காத விஷயங்களுக்கு துணை போய் கொண்டு இருக்கிறோம்.

உதாரணத்துக்கு தேர்தலில் நமக்கு ஒரு சுயேச்சை வேட்பாளரை பிடித்து இருந்தாலும் அவர் வெற்றிபெற வாய்பே இல்லை என நாமே தவறாக முடிவு செய்து, நாம் அவருக்கு வாக்களிப்பது வீண் எனவும் முடிவு செய்து, நமக்கு பிடிகாதவராய் இருப்பினும், வெற்றி வாய்ப்பு அதிகம் என நினைக்கும் நபர்களில் நமக்கு ஓரளவுக்கு பிடித்த அல்லது பிடிகாதவர்களிலேயே ஓரளவுக்கு பரவாயில்லை என நினைக்கும் நபருக்கு வாக்களிக்கிறோம். இல்லை வாக்களிகாமலேயே இருந்து விடுகிறோம். இதனால் உண்மையில் நாம் விரும்பிய சுயேட்சையே பலருக்கு பிடித்தவராக இருப்பினும் அவர் நமது பிரதிநிதியாக தேர்ந்தெடுக்கப்பட வாய்பே இல்லாமல் போய்விடுகிறது.

இத்தகைய தவறினை நாம் உடனடியாக நிறுத்த வேண்டும். அவர் இந்த தேர்தலில் வெற்றி பெற முடியாமல் போனாலும் அவர் பெரும் சில வாக்குகள் இவ்வாறு வெற்றி பெற வாய்ப்பில்லை என நினைத்து வேறு நபர்களுக்கு வாக்களித்தவர்கள் அடுத்த தேர்தலிலாவுது திருத்திக்கொள்ள உதவும். இந்த தேர்தலில் வெற்றிபெறாவிட்டாலும் அடுத்த தேர்தலில் அவர் வெற்றி பெற உதவும்.

எனவே தயவு செய்து உங்களுக்கு பிடித்தவர்களுக்கு வாக்களியுங்கள். வாக்களியுங்கள்.

01 April 2009

Type checking macros

#define to_cpumask(bitmap)                                              \
((struct cpumask *)(1 ? (bitmap) \
: (void *)sizeof(__check_is_bitmap(bitmap))))
static inline int __check_is_bitmap(const unsigned long *bitmap)
{
return 1;
}


The above macro is nothing but just
#define to_cpumask(bitmap) (struct cpumask *)(bitmap)

But it also does a compile-time checking that the parameter passed is of type
(const unsigned long *). If it is defined as an function all these ugly magic is not
needed. But a function cannot be used as a static initializer. Try declaring a variable,
static int a = printf("ok");
and one would get an error, "Initializer element is not constant".

I really wonder whether gcc might one day optimize out your type-checking call to the unused
function in tha above macro?! A solution could be providing an official gcc extension to assert types?!
Also the above code compiles fine without sizeof constification as well i.e., just return a void * from the
__check_is_bitmap() and remove the sizeof and casting.

I found the above code in the linux kernel. See http://lkml.org/lkml/2009/3/25/22
for the discussion. Even the ubiquitous printf, printk or any vararg code does not check for types. So
I wonder whether kernel developers need such tricky^Wugly code just for type checking, given that
the callers would likely read the definition of the macro as well. It is not a closed api.

Any other project uses such type-checking macros?