Macro version still evaluate the argument more than once regardless you name it 
kisdigit or isdigit. I am fine with any following combination:
1.lookup table for both userspace and kernel
2.normal function for both userspace and kernel
3.lookup table for userspace and normal function for kernel
But Macro which can't guarantee to evaluate the argument only once isn't a good 
candidate even it is just used in kernel space.

> -----Original Message-----
> From: Gregory Nutt <spudan...@gmail.com>
> Sent: Friday, July 31, 2020 9:57 PM
> To: dev@nuttx.apache.org
> Subject: Re: [GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change 
> in pull request #1487: libc: Avoid ctype function to
> evaluate the argument more than once
> 
> 
> > ....  My size concern is only in the PROTECTED build mode.  In that
> > case, the ROM table would be duplicated:  Once in user-space and once
> > in kernel space.  That is the wasteful part because the OS does NOT do
> > any significant string processing and is a case where there would be
> > an unnecessary size penalty.
> >
> > If we ignore libs/ and tools/, there is almost no use of ctype.h in
> > the OS:
> >
> >     ./boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c:#include
> >     <ctype.h>
> >     ./boards/renesas/m16c/skp16c26/src/m16c_lcd.c:#include <ctype.h>
> >     ./drivers/audio/tone.c:#include <ctype.h>
> >     ./drivers/syslog/syslog_rpmsg.c:#include <ctype.h>
> >     ./fs/dirent/fs_opendir.c:#include <ctype.h>
> >     ./fs/fat/fs_fat32dirent.c:#include <ctype.h>
> >
> And, worse, most of these are not used in a "typical" configuration. But a 
> couple are frequently included and that is enough to drag in
> the entire kernel-space copy of the lookup table into the build.

Reply via email to