|
|
|
|
|
by scoutt
2020 days ago
|
|
It's a bad idea, especially in kernel/low-level/performant code. It's OK to check some values at specific points (like when a value is passed from user space), but in general it's bad practice to check it at every single function. You trust in your program flow. Imagine if at every function down a complex stack you go with: if (!ptr1 || !*ptr1 || *ptr1 > 5 || param1 < 0 || param2)
/* etc.... */
{
return NULL;
}
(used arbitrary names and values). |
|