Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: byo on March 07, 2007, 01:58:51 am

Title: All devs: watch out for memset
Post by: byo on March 07, 2007, 01:58:51 am
I've just read some note written by Krzysztof Kowalczyk on his blog (http://blog.kowalczyk.info/) titled: "memset() considered harmful" ().
He has written that people usually swap second ant third parameter which in case of zeroing some data will do nothing.

There's also a query (http://www.google.com/codesearch?hl=en&lr=&q=memset%5Cs*%5C%28.%2B%2C%5Cs*0%5Cs*%5C%29&btnG=Search) which shows that at least half of calls is invalid.

I've already checked C::B and it has no such "mistakes" :D
But it may be a good tip to check your code ;)

BYO
Title: Re: All devs: watch out for memset
Post by: MortenMacFly on March 07, 2007, 07:25:25 am
Whohooo... found one... in a quite old piece of code. Luckily it was only *one* and obviously it didn't cause any harm. But the number of google results scare me a little... ;-)
With regards, Morten.