News for hackers. Stuff that matters.
Re:Bounded Integer: Header-only C++ library replaces integer... by SomeOldThrow on Sunday September 29, 2019 @11:15AM (#21107505)
How are you envisioning this library being used?
Re:Bounded Integer: Header-only C++ library replaces integer... by asveikau on Sunday September 29, 2019 @11:58AM (#21107755)
What?

I am saying the author did not express the limitation well, and instead made it sound like they don't understand sizeof(int). The explanation that leni536 offered makes a lot more sense, so maybe they should have put it that way instead of using an easily misunderstood term as "built-in integer" to mean "one of several integer types that we may choose based on some ifdef"

Re:Bounded Integer: Header-only C++ library replaces integer... by SomeOldThrow on Sunday September 29, 2019 @10:14PM (#21111191)
Why did you arrive at this confusion?

Why would you assume your observations are relevant to the use case?

Re:Bounded Integer: Header-only C++ library replaces integer... by asveikau on Monday September 30, 2019 @01:18AM (#21111966)
Did you read this part:

> bounded::integer uses built-in integers as the template parameter to determine its bounds. This means that it cannot store an integer larger than ...

They say the limitation arises from using "built-in integers" as template parameters. It is reasonable to assume "built-in integer" means "int". It is more a stretch to assume "built-in integer" means any number of types depending on the evaluation of several ifdefs [which is what I found in the source].

There is nothing about a "use case" relevant to any of that quoted statement, so I find your reply very confusing too.

Re:Bounded Integer: Header-only C++ library replaces integer... by SomeOldThrow on Monday September 30, 2019 @10:54AM (#21115993)
> It is reasonable to assume "built-in integer" means "int".

This strikes me as a little nuts for C but it definitely explains this thread. I just assumed people had already switched over to e.g. sint32/size_t to avoid this problem a long time ago. I couldn’t tell if this was a legitimate complaint or someone’s language lawyering tendencies gone too far.

Re:Bounded Integer: Header-only C++ library replaces integer... by asveikau on Monday September 30, 2019 @12:36PM (#21117150)
First of all, we're not talking C. This is a C++ template parameter. The feature doesn't exist in C.

Second, it is not "nuts" to use int, I would argue it's quite a bit more crazy to use rarely-supported 128-bit quantities when you don't need them. Your suggestion of "sint32" (this is not a standardized typedef, you mean int32_t perhaps) would be the same as int on most compilers today, and size_t is likewise very often 32 bits. Your suggestion is basically a no-op in a lot of places. Domain-specific areas like file formats or network protocols are a different story, as those have to be explicit about specifying sizes.

Third:

> someone’s language lawyering tendencies

I suggest you avoid passive-aggressive communication style and just say "you" instead of "someone". If you're going to criticize or give feedback, be direct. Don't vaguely tell me that "somebody" "might" have a problem.

Best regards to you, friend.

Re:Bounded Integer: Header-only C++ library replaces integer... by SomeOldThrow on Monday September 30, 2019 @05:56PM (#21120062)
Hey I was just trying to figure out if you were bringing up anything of value :)