Re: [Sdcc-user] Standard library printf() %p endianness

2021-11-14 Thread Maarten Brock
Philipp Klaus Krause schreef op 2021-11-11 19:58: Am 10.11.21 um 23:38 schrieb Basil Hussain: Hi all, Quick question: was the SDCC standard library printf() implementation for the %p conversion specifier written only with little-endian platforms (e.g. 8051) in mind? Sorry, bu, you are unlikel

Re: [Sdcc-user] Standard library printf() %p endianness

2021-11-12 Thread Basil Hussain
I have created a feature request: https://sourceforge.net/p/sdcc/feature-requests/756/ Included there is a test program to demonstrate the issue. If I have time, and I can get my SDCC build environment going again, I may try to fix it myself and submit a patch. Regards, Basil Hussain On 11

Re: [Sdcc-user] Standard library printf() %p endianness

2021-11-11 Thread Philipp Klaus Krause
Am 11.11.21 um 19:04 schrieb Basil Hussain: > > It's only a small detail, and arguably not strictly 'wrong' for > big-endian platforms because %p formatting is (as far as I could > determine) "implementation defined", but I think this should be fixed. > Shall I create a feature request? Or a bug r

Re: [Sdcc-user] Standard library printf() %p endianness

2021-11-11 Thread Warner Losh
In a big endian system, the address 0x12345678 is represented by the bytes 78 56 34 12 on a little endian system, and by 12 34 56 78 on a big endian system. In my experience, both print out, with %p, as 0x12345678. It's not really a matter of 'byte swapping', per se, but rather interpreting the byt

Re: [Sdcc-user] Standard library printf() %p endianness

2021-11-11 Thread Bodo Wenzel
Pragmatically, if there is something to check endianness, make a working chance for all targets, or at least non-breaking for little-endian systems. I see not much value in finding by whom or why this little-endian-only solution was written, because for me it is a clear error. The implementation-

Re: [Sdcc-user] Standard library printf() %p endianness

2021-11-11 Thread Philipp Klaus Krause
Am 10.11.21 um 23:38 schrieb Basil Hussain: > Hi all, > > Quick question: was the SDCC standard library printf() implementation > for the %p conversion specifier written only with little-endian > platforms (e.g. 8051) in mind? Sorry, bu, you are unlikely to get an answear. I have been an SDCC dev

Re: [Sdcc-user] Standard library printf() %p endianness

2021-11-11 Thread Basil Hussain
I think I found where %p values are formatted in the SDCC source, in printf_large.c line 658: https://sourceforge.net/p/sdcc/code/HEAD/tree/trunk/sdcc/device/lib/printf_large.c#l658 Is this the right code? For all platforms other than DS390 and MCS51, which have their own code branches, the co

[Sdcc-user] Standard library printf() %p endianness

2021-11-10 Thread Basil Hussain
Hi all, Quick question: was the SDCC standard library printf() implementation for the %p conversion specifier written only with little-endian platforms (e.g. 8051) in mind? I ask because I encounter once again today an annoyance I've encountered before when working on big-endian target platf