xiaoxiang781216 commented on code in PR #7702:
URL: https://github.com/apache/nuttx/pull/7702#discussion_r1038769231


##########
arch/arm/src/sama5/sam_adc.c:
##########
@@ -865,7 +935,7 @@ static void sam_adc_endconversion(void *arg)
   int ret;
 
   DEBUGASSERT(priv != NULL);
-  ainfo("pending=%08x\n", priv->pending);
+  ainfo("pending=%08lx\n", priv->pending);

Review Comment:
   > That discussion is slightly beyond me, but I'm trying to understand if 
using %08lx is actually WRONG rather than just a difference in approach.
   
   no prefix mean int, l prefix is for long int. But int32_t may map to int or 
long int which depends on arch and toolchain(#7476), so it's wrong to either 
use l prefix or no prefix for int32_t. To make programmer life easier, the 
standard introduce PRI[d|u|x]32 as the int32_t format specifier.
   
   > We _can_ use C99 in arch but don't HAVE to? I have always used the %08x 
type formatters, probably because I learnt C back in the 1980's (K&R!).
   > 
   
   So the rule is simple:
   int: no prefix
   long: l prefix
   long long: ll prefix
   int32_t: PRI[o||d|u|x]32
   Here has some discussion:
   
https://stackoverflow.com/questions/3168275/printf-format-specifiers-for-uint32-t-and-size-t?rq=1
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to