Is it possible to create just a simple Kconfig list of choices like this?

int64_t time_t <-- default
int32_t time_t
uint32_t time_t

This should cover most use cases and give developer a choice on
smaller / older platforms right?

There will be no inconsistencies autodetections variants (whatever
hidden actions) nor dependencies on target platforms / toolchains just
a manual conscious simple choice by the developer in one single place
:-)

I guess there is no sense to add 16-bit types to the list?

And we will have one single place to add int128_t when RV128 shows up :-)

Would that meet everyone needs and expectations? Plus maybe some
visible initial configuration message what type is used :-)

Tomek




On Wed, Nov 6, 2024 at 3:18 AM Xiang Xiao <xiaoxiang781...@gmail.com> wrote:
>
> Yes, I prefer 64bit time_t to map to int64_t unconditionally, since 64bit
> time_t is seldom selected by NuttX supported boards now, and no 2038
> problem.
> For 32bit time_t, we can add a Kconfig to let the user select
> signed/unsigned and default to unsigned for compatibility reasons.
>
> On Wed, Nov 6, 2024 at 9:40 AM Takashi Yamamoto
> <yamam...@midokura.com.invalid> wrote:
>
> > > I don't think, personally, that any of this is reason enough to worry
> > about
> > > it. Using an int64_t for time_t is IMO a perfectly reasonable default for
> > > 32-bit and up targets. and possibly for all targets. Offering a kconfig
> > > option to support 32-bit (signed or unsigned) time_t offers an easy
> > > work-around should anyone find that the couple of percent increase in
> > code
> > > size and execution time causes their project to fail - or if anyone is in
> > > the unfortunate situation where they depend on code that's made
> > assumptions
> > > about size or signedness.
> >
> > ideally, we should use int64_t for all targets unconditionally, IMO.
> > however, in practice, 64-bit integers don't seem available for some of
> > our targets. (ez80, z8, z16)
> > maybe someone can add 64-bit integer support to their toolchains. but
> > i suppose we don't want to wait for it to happen.
> >



-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Reply via email to