Applying the logical not (!
) operator twice has the purpose of normalising a value to be either 0 or 1. In a control expression of an if-statement, that doesn’t make any difference. The if-statement only cares about the value being zero or nonzero, the little !!
dance is completely useless.
Some coding style guides might mandate this kind of dance, which could be the reason why the TI code you posted does it. I haven’t seen any that do so though.
Related Contents:
- What does i = (i, ++i, 1) + 1; do?
- What is the purpose of the unary plus (+) operator in C?
- Why an expression instead of a constant, in a C for-loop’s conditional?
- Are compound statements (blocks) surrounded by parens expressions in ANSI C?
- How do I determine the size of my array in C?
- Stack smashing detected
- What are the most common naming conventions in C?
- What is the difference between memmove and memcpy?
- Turn a simple socket into an SSL socket
- Why do I get “a label can only be part of a statement and a declaration is not a statement” if I have a variable that is initialized after a label? [duplicate]
- How does strtok() split the string into tokens in C?
- How can I tell if a library was compiled with -g?
- Undefined reference to `sin` [duplicate]
- What are vdso and vsyscall?
- malloc for struct and pointer in C
- Difference between surface and texture (SDL / general)
- Does stack grow upward or downward?
- C char array initialization: what happens if there are less characters in the string literal than the array size?
- How can I read an input string of unknown length?
- How to use /dev/random or urandom in C?
- How do you declare string constants in C?
- How to Declare a 32-bit Integer in C
- Left shifting with a negative shift count
- Why is memory allocation on heap MUCH slower than on stack?
- Check glibc version for a particular gcc compiler
- CMAKE – How to properly copy static library’s header file into /usr/include?
- Can a C macro definition refer to other macros?
- Append to GNU make variables via command line
- Getting a weird percent sign in printf output in terminal with C
- How to convert big endian to little endian in C without using library functions?
- How do I link object files in C? Fails with “Undefined symbols for architecture x86_64”
- Can GCC not complain about undefined references?
- Is a C compiler allowed to coalesce sequential assignments to volatile variables?
- Does standard c library provides linked list etc. data structures?
- Are empty macro definitions allowed in C? How do they behave?
- How to make an HTTP get request in C without libcurl?
- atoi — how to identify the difference between zero and error?
- How can Inheritance be modelled using C? [duplicate]
- Generate compiler warning if const char* array initialization comma is missing
- How to use netlink socket to communicate with a kernel module?
- Can I compare int with size_t directly in C?
- Why does GCC create a shared object instead of an executable binary according to file?
- Why does “memset(arr, -1, sizeof(arr)/sizeof(int))” not clear an integer array to -1?
- Using Go code in an existing C project
- How to check if a variable has been initialized in C?
- How do I extract specific ‘n’ bits of a 32-bit unsigned integer in C?
- What’s the algorithm behind sleep()?
- Kill Thread in Pthread Library
- Why does C not have a logical assignment operator?
- Segmentation fault handling