Skip to end of metadata
Go to start of metadata

The first two tables list CERT C Coding Standard rules and recommendations that are Applicable in Principle, meaning that the guideline can be applied to Android app development, but examples currently shown in the guideline are not yet relevant to Android. The third table lists rules and recommendations with Unknown applicability, meaning they are guidelines whose applicability to Android app development has not yet been determined.

Contents

 

Rules/Applicable in Principle to Android Development

Rules Comments
DCL38-C. Use the correct syntax when declaring a flexible array member Arrays: Need examination of Android support. (gcc support of arrays partial). Note native code array issues different with ART than with Dalvik: http://developer.android.com/guide/practices/verifying-apps-art.html#JNI_Issues 
EXP36-C. Do not cast pointers into more strictly aligned pointer types36C ARM chips more strict, X86 not so strict (so, relevant). 
INT35-C. Use correct integer precisionsCurrently may not apply; if no 64-bit Android phones (although current   news says on the way)
FLP32-C. Prevent or detect domain and range errors in math functionsMaybe currently, a restriction on size of ints/doubles, etc. (64 bit   chips)
FLP34-C. Ensure that floating-point conversions are within range of the new typeMaybe currently, a restriction on size of ints/doubles, etc. (64 bit   chips)
FLP36-C. Preserve precision when converting integral values to floating-point typeMaybe currently, a restriction on size of ints/doubles, etc. (64 bit   chips)
STR30-C. Do not attempt to modify string literalsSTR: rest, yes
STR31-C. Guarantee that storage for strings has sufficient space for character data and the null terminatorSTR: rest, yes
MEM33-C. Allocate and copy structures containing a flexible array member dynamically Arrays: Need examination of Android support. (gcc support of arrays partial). Note native code array issues different with ART than with Dalvik: http://developer.android.com/guide/practices/verifying-apps-art.html#JNI_Issues 
FIO39-C.   Do not alternately input and output from a stream without an intervening   flush or positioning call 
FIO30-C. Exclude user input from format stringsUniversal
FIO47-C. Use valid format stringsUniversal
SIG30-C. Call only asynchronous-safe functions within signal handlersSigAction may solve these   problems. If Android supports SigAction, these rules/recommendations may not   be needed.      http://stackoverflow.com/questions/7245550/android-app-restarts-automatically-after-a-crash
SIG31-C. Do not access shared objects in signal handlersSigAction may solve these   problems. If Android supports SigAction, these rules/recommendations may not   be needed.      http://stackoverflow.com/questions/7245550/android-app-restarts-automatically-after-a-crash
SIG34-C. Do not call signal() from within interruptible signal handlersSigAction may solve these   problems. If Android supports SigAction, these rules/recommendations may not   be needed.      http://stackoverflow.com/questions/7245550/android-app-restarts-automatically-after-a-crash
SIG35-C. Do not return from a computational exception signal handlerSigAction may solve these   problems. If Android supports SigAction, these rules/recommendations may not   be needed.      http://stackoverflow.com/questions/7245550/android-app-restarts-automatically-after-a-crash

 

Recommendations/Applicable in Principle to Android Development

Recommendations Comments
FLP04-C. Check floating-point inputs for exceptional valuesMaybe currently, a restriction on size of ints/doubles, etc. (64 bit   chips)
FLP05-C. Do not use denormalized numbersMaybe currently, a restriction on size of ints/doubles, etc. (64 bit   chips)
FLP06-C. Convert integers to floating point for floating-point operationsMaybe currently, a restriction on size of ints/doubles, etc. (64 bit   chips)
FLP07-C. Cast the return value of a function that returns a floating-point typeMaybe currently, a restriction on size of ints/doubles, etc. (64 bit   chips)
STR11-C. Do not specify the bound of a character array initialized with a string literal Arrays: Need examination of Android support. (gcc support of arrays partial). Note native code array issues different with ART than with Dalvik: http://developer.android.com/guide/practices/verifying-apps-art.html#JNI_Issues 
SIG00-C. Mask signals handled by noninterruptible signal handlersSigAction may solve these   problems. If Android supports SigAction, these rules/recommendations may not   be needed.      http://stackoverflow.com/questions/7245550/android-app-restarts-automatically-after-a-crash
SIG01-C. Understand implementation-specific details regarding signal handler persistenceSigAction may solve these   problems. If Android supports SigAction, these rules/recommendations may not   be needed.      http://stackoverflow.com/questions/7245550/android-app-restarts-automatically-after-a-crash
SIG02-C. Avoid using signals to implement normal functionalitySigAction may solve these   problems. If Android supports SigAction, these rules/recommendations may not   be needed.      http://stackoverflow.com/questions/7245550/android-app-restarts-automatically-after-a-crash
API02-C. Functions that read or write to or from an array should take an argument to specify the source or target size Arrays: Need examination of Android support. (gcc support of arrays partial). Note native code array issues different with ART than with Dalvik: http://developer.android.com/guide/practices/verifying-apps-art.html#JNI_Issues 
API05-C. Use conformant array parameters Arrays: Need examination of Android support. (gcc support of arrays partial). Note native code array issues different with ART than with Dalvik: http://developer.android.com/guide/practices/verifying-apps-art.html#JNI_Issues 
MSC19-C. For functions that return an array, prefer returning an empty array over a null value Arrays: Need examination of Android support. (gcc support of arrays partial). Note native code array issues different with ART than with Dalvik: http://developer.android.com/guide/practices/verifying-apps-art.html#JNI_Issues