datasheets.com EBN.com EDN.com EETimes.com Embedded.com PlanetAnalog.com TechOnline.com  
Events
UBM Tech
UBM Tech

Message Board

Andrey Karpov

Software diseases: memset

Andrey Karpov

7/23/2012 7:58 AM EDT

While analyzing the source codes of various programs I can't help creating associations that each program has a tendency to certain diseases. In many projects you can easily make out patterns of incorrect code that can be found in different project files. In some programs these are Copy-Paste errors, while in others it's "unsigned_integer less 0"-like checks. Each project has its own disease. The sore of the next project (called MAME) we have checked is the memset() function.

http://www.viva64.com/en/b/0154/






ReneCardenas

7/27/2012 12:01 PM EDT

Great article, and wonder if any future code analysis can be embeded in IDEs or compilers to assist for improved programming results from begineer and itermediate skilled programmers.

Although, bad programming can be generated by abscent minded individuals, as well as automation directed by the wrong person.

Sign in to Reply



DonkeyHotay

8/2/2012 2:57 PM EDT

Bad code is generated by lazy (and arguably incompetent) coders who fail to read and understand the manual page(s) for the library routines they misuse. The article appears to complain about the routines, not the coders inability to use the functions correctly.

http://www.cplusplus.com/reference/clibrary/cstring/memset/
http://www.cplusplus.com/reference/clibrary/cstring/memcpy/

For those lucky enough to have access to a Unix/Linux/POSIX environment,
man 3 memset
man 3 memcpy

TANJ

Sign in to Reply



Please sign in to post comment

Navigate to related information

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)