#1153357 cppcheck: syntaxError: -!!x

Package:
cppcheck
Source:
cppcheck
Description:
tool for static C/C++ code analysis (CLI)
Submitter:
Alejandro Colomar
Date:
2026-11-07 17:55:02 UTC
Severity:
normal
#1153357#5
Date:
2026-11-07 17:53:33 UTC
From:
To:
Dear Maintainer,

cppcheck(1) seems to report a syntaxError in the following line of code:

	return -!!status;

which is perfectly valid C (and AFAIK, also C++).

Here's an example of a function in which that happens:

	inline int
	a2sll_nc(long long *restrict n, char *restrict s,
	    char **restrict endp, int base,
	    long long min, long long max)
	{
		int  status;

		*n = a2i_strtoi(s, endp, base, min, max, &status);
		if (status != 0)
			errno = status;

		return -!!status;
	}

This seems to be a regression, since I hadn't seen that error before.
However, I don't know when it started appearing, since it's been more
than a year since I last analyzed that code.


Have a lovely night!
Alex