Thanks Tician,
Yep - I also prefer the braces on their own lines, but have alternated on different projects to have the { on same line as on some projects had people complaining that the other way takes up too many lines so you can not see much code...
Likewise with tabs versus non-tabs and spacing... Many arguments over the years.. So I try to go with flow... Things like yes with tabs, each user can use their own preferences for how many show up on display, which works well for start of line, but when users do things like tabs inside lines to line up things (like member variable names), they only line up properly for the same tab setting... But again I would simply like to go with the flow...
One things I do like to do is to do things like remove compiler warnings. Back in my previous life, there used to be rules you could not check in code that had warnings, which sort-of stuck with me. Earlier I made a pass to remove most/all of them, but as more code is being integrated in, like the streamer code, I seeing more of them. So yesterday did a pass through some of the stuff again and put a partial update for this in my working branch (once done, may see about making it into a pull request..)
Some of them I have not fixed yet, for example in dxl_monitor, complains that function gets is not safe... So will probably convert to fgets, which you pass in buffer length... But will have to change code a little as \n will be part of buffer...
Note some of the fixes I did to remove warnings are good things, like change some of the functions and or methods, to "const char *" instead of simply "char *". This removes warnings if you try to set the pointer to Quoted character strings, like: ptr = "Text"
But some of the changes were sort of superficial, like when the code is not checking the result of a function. Example:
Code:
write(fd, buffer, strlen(buffer));
The change I did removes warning, but still does not check:
Code:
int res __attribute__((unused));
res = write(fd, buffer, strlen(buffer));
Again it would probably be better to actually do something with the result, maybe simply assert, or ...
Bookmarks