On Thu, Jan 26, 2017 at 6:25 AM, Kang-Che Sung <[email protected]> wrote: > May I ask some little code questions? I have been reading some of the > changes in busybox and I don't understand the use of type "smallint" in > this code > > 9a64c3337cc0a5e84e9ad457eeb1d475c311e9fc "ls: convert DISP_DIRNAME to > a bool variable" > > ls.c > > @@ -330,7 +326,7 @@ struct globals { > # define G_show_color 0 > #endif > smallint exit_code; > - unsigned all_fmt; > + smallint show_dirname; > #if ENABLE_FEATURE_LS_WIDTH > unsigned terminal_width; > # define G_terminal_width (G.terminal_width) > > Here it seems that this "show_dirname" variable is supposed to hold a > boolean value, but why not declare it with the type bool? What's the > rationale behind preferring smallint?
size of bool is controlled by compiler. If on some arch people who decide on its ABI would decide that int-sized bools are somewhat faster and settle for that, bbox will have to use that even if we'd prefer "smaller" (if performance hit is not too bad). smallints are ours. bbox defines their sizes. _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
