I have been playing around with git and editing kernel files with the ./scripts/checkpatch.pl command. While most of the proposed edits seem pretty straight forward, there have been enough that are not, and make me nervous that I may be changing the function of some of the programs.
For example:
To me this seems fine and I would think it is a false positive as it would seem to me this is simple multiplication to return a value.
Here, the suggestion is different and I don't understand why '*' would be to one side or the other. I would say it's an example of what not to name a variable and take a ruler to whosoever hands! Or is it just a typo?
So here we are again with what is in my opinion a bad variable '(char*)' that later becomes '(char *)'. WTF!? Wheres my ruler?
Are there valid reasons for poor naming conventions such as foo* or *foo and such.
Back in the day when I was taught to write the programs we used to do our job we would have had bloody knuckles, sore ears and or a knot in the back of the head.
How do I make a determination and or better yet query the individual responsible or community to find out how to proceed?
I can't believe such errors would compile let alone run.
Don't get me wrong, I know this stuff isn't easy and fat fingers happen to us all but this just seems like screw it.
I have not written anything in a long time and much has changed but I am trying to learn the new stuff to try and give back to the community with what is basically style corrections till i get better, It just amazes me that stuff like this is in the source and there are tools in place to check for it.
On a side note does anyone know of anything training wise that may have a program with known errors you are to fix and then compare to a master?
For example:
ERROR: "foo * bar" should be "foo *bar" INTERNAL_SIZE_T sz = n * elem_size;
To me this seems fine and I would think it is a false positive as it would seem to me this is simple multiplication to return a value.
ERROR: "foo* bar" should be "foo *bar" size_t malloc_usable_size(Void_t* mem)
Here, the suggestion is different and I don't understand why '*' would be to one side or the other. I would say it's an example of what not to name a variable and take a ruler to whosoever hands! Or is it just a typo?
assert (chunk_is_mmapped(p)); assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); assert((n_mmaps > 0)); assert(((p->prev_size + size) & (malloc_getpagesize-1)) == 0); n_mmaps--; mmapped_mem -= (size + p->prev_size); ret = munmap((char *)p - p->prev_size, size + p->prev_size);
So here we are again with what is in my opinion a bad variable '(char*)' that later becomes '(char *)'. WTF!? Wheres my ruler?
Are there valid reasons for poor naming conventions such as foo* or *foo and such.
Back in the day when I was taught to write the programs we used to do our job we would have had bloody knuckles, sore ears and or a knot in the back of the head.
How do I make a determination and or better yet query the individual responsible or community to find out how to proceed?
I can't believe such errors would compile let alone run.
Don't get me wrong, I know this stuff isn't easy and fat fingers happen to us all but this just seems like screw it.
I have not written anything in a long time and much has changed but I am trying to learn the new stuff to try and give back to the community with what is basically style corrections till i get better, It just amazes me that stuff like this is in the source and there are tools in place to check for it.
On a side note does anyone know of anything training wise that may have a program with known errors you are to fix and then compare to a master?