• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by fml2 - 2007-04-14

FS#7030 - Adds the printf format for pointers (%p or %P)

This adds the printf format for pointers. Use %p or %P.


int *p;
printf(”Int value at %p is %d”, p, *p);

Also corrected the code indentation and factored out duplicated code.

Closed by  petur
2007-04-16 11:33
Reason for closing:  Rejected
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

the addition to the bin size just isn\'t worth it

fml2 commented on 2007-04-14 19:30

With this patch, %x and %p produce lower case hex and %X and %P produce upper case hex.

Also fixed copy&paste error.

fml2 commented on 2007-04-14 20:47

This also adds %i as a synonym for %d.

petur commented on 2007-04-15 08:18

Unless there’s any real use to this, this patch only increases binary size.
For example, H300 went from 414528 to 414868 (+340 bytes)

Apart from that, I did look at the patch and enhanced it a bit, so here’s my version.
The inline is used because performance is important

fml2 commented on 2007-04-15 08:33

Removed %P since it doesn’t seem to be in the printf spec. Making funcs inline would probably increase the binary size.

I’ve added the %p tag because I wanted to investigate how pointers are affected by IRAM attributes and found out that the tag isn’t present in RB. Should I cast pointers to long to display them?

fml2 commented on 2007-04-15 14:04

BTW: to further reduce the binary size, %i (for int) can be removed. I introduced it to be as near as possible to the ‘official’ printf spec, but if RB doesn’t need it (and I think it doesnt’t) it can be removed.

@petur: why do you think performance in printf is so important? Could we trade a little bit of speed for binary size?

fml2 commented on 2007-04-15 20:10

Petur, I tried some combinations of code changes and you are right: the binary size increases. I don’t undestand why but it does. So we can refuse on this change and use conversion to long instead.

petur commented on 2007-04-15 22:44

Well I give up on this. I tried to just write some parts of the SVN version nicer and more compact, but whatever I try, the binsize grows. Attached is my last try, but I’ll probably close this patch anyway as it’s grown pretty useless.

fml2 commented on 2007-04-16 07:12

Same here. And agreed on closing. But it’s weird, no? :-)


Available keyboard shortcuts


Task Details

Task Editing