cavaliercoder/dmidecode-osx

&/&& confusion?

RJVB opened this issue · 3 comments

RJVB commented

Clang just pointed out this to me:

dmidecode.c:4514:26: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
                                                DWORD(data + 0x0A) && 0xFF);
                                                                   ^  ~~~~
dmidecode.c:4514:26: note: use '&' for a bitwise operation
                                                DWORD(data + 0x0A) && 0xFF);
                                                                   ^~
                                                                   &
dmidecode.c:4514:26: note: remove constant to silence this warning
                                                DWORD(data + 0x0A) && 0xFF);
                                                                  ~^~~~~~~
2 warnings generated.

Looking at the code:

					printf("\tFirmware Revision: %u.%u\n",
						DWORD(data + 0x0A) >> 16,
						DWORD(data + 0x0A) && 0xFF);

I think that clang is right, a bitwise AND is intended here.

Totally agree. I spotted this too. I have left this as-is though, as this is an issue in the upstream code and I'd like to keep this fork as succinct as possible. If it's fixed upstream, we can merge it in.

RJVB commented

Ok... I trust you filed an issue?

Unfortunately, no. This project hasn't proven popular enough for me to get involved in the upstream more closely.