Blogger Template by Blogcrowds

buggy ruggy muggy

For once, i am writing something other than movies and cricket.

short int func(int a, short int b)
{
b = b + a;
return b;
}
Run Klocwork on this piece of code, you will get the following error
Line 3: Conversion from int to short int may cause loss of data

For those who are not aware of Klocworks, its a static code analyzer.

short int func(int a, short int b)
{
b += a;
return b;
}
Now, run klocworks on this piece of code and no error is reported.

Functionality wise, there is absolutely no difference between the 2.

b = b + a; /* Error */
b += a; /* Not an error */

In both the cases, 4 bytes are written into the variable 'b' which can hold only 2 bytes. But, why no error is reported for the second case?? unga yaarukaachi ethunaavathu difference therinja sollunga ba..

And, the unwritten rule of our room is,if there is a possible rhyme, say it.
Everything above is about Klocworks and
everything below is about vxWorks.
(Forgot to add this. Say it, however mokkai the rhyme is.)

A trivia
The name VxWorks is believed to be a pun on the VRTX real-time operating system, at the time created by Ready Systems. In the early 1980s VRTX was a new product and did not work so well. Wind River acquired the rights to resell VRTX with an extension named VxWorks which was workable, so VxWorks most probably means VRTX now Works or VRTX that Works.

7 Comments:

  1. U said...
    everything as of now doesnt work machi.

    Mudilaaaaaaaaaaaa ..
    Arun said...
    same here
    Ramakrishnan said...
    technical post, you too ila ?
    U said...
    you too ?????

    appo vera yaru ellam erukanga...
    Arun said...
    chumma oru change ku. also, just to keep the blog active..
    Ganesh M said...
    Arun Are u thinking that recruiters will read ur blog by any chance :-)
    Arun said...
    apdiye vandhu padichitaalum.. as of now, only managers like u and PL like me are reading.

Post a Comment



Newer Post Older Post Home