On Mon, Nov 13, 2017 at 09:04:40PM +0100, Wolfgang Denk wrote: > Dear Heinrich, > > In message <20171110204634.20515-1-xypron.g...@gmx.de> you wrote: > > 0 is not a pointer. So do not compare pointers to 0. > > Who says so? 0 can be the value of a pointer to a valid, existing > address. For example a large number of Power Architecture systems > map the RAM beginning at physical address 0, so if you want to > wrtite to the very first byte in memory your pointer value is 0.
I think you just proved the point here. One can write clever code knowing that on architecture X we can do trick Y (and hey, for well commented assembly, go reasonably nuts!0. But in C and as we get more and better and easier to use static analysis tools we write clear and consistent code. > > Do not return 0 from functions with a pointer return > > type. > > Why? It could be a valid value - or not. > > > - if (new_address == 0) > > + if (!new_address) > > In which way is "new_address == 0" and "!new_address" different? And yes, it's not going to change the generated code. Really, the best argument for not changing anything in this file is that it brings us further from upstream, and we've neither thrown that notion out the window nor frequently re-synced with it. -- Tom
signature.asc
Description: PGP signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot