Skip to content
0:00 / 0:00

#c++#goingnative#unsignedintegers

Interactive Panel: Ask Us Anything

aghuttun

4.2K subscribers • 7 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

35K views13 years ago2 recommendations

Programming languagesSystems programmingC++Language design and type systems

A panel of prominent C++ experts answers attendee questions, including a discussion on why unsigned integers should generally be avoided.

Day 2 - Attendee-driven Q&A with Day 1 and Day 2 speakers: Bjarne Stroustrup, Andrei Alexandrescu, Herb Sutter, Scott Meyers, Chandler Carruth, Sean Parent, Michael Wong, and Stephan T. Lavavej.

Why it's here

2 people recommend this

What people say. Often cited for the segment where Bjarne Stroustrup and Herb Sutter advise against using unsigned integers except for bit patterns.

Moments people linked to

u/Tasty_Replacement_29Bauin r/ProgrammingLanguages • Recommends

On “Unsigned Sizes: A Five Year Mistake”

There are two related presentations: * [video , at minute 13, Bjarne Stroustrup says use unsigned only for bit patterns, and don't mix signed and unsigned. (To be honest, you can use signed for bit patterns as well, just that you need to shift unsigned.) * link to this video - which is quite funny.

u/NoahRealnamein r/ProgrammingLanguages • Recommends

On “Unsigned Sizes: A Five Year Mistake”

In "Going Native 2012, Day 2, Interactive Panel: Ask Us Anything" (your first link), they mention two more times that you shouldn’t use unsigned int: * 42:41 - 45:28 Bjarne Stroustrup and Herb Sutter recommend using *signed* integer. * 1:02:51 - 1:03:14 Herb Sutter and Chandler Carruth about *unsigned* `size_t` in the C++ STL containers: “They are wrong”, “We are sorry”
3View on Reddit

u/phlummoxin r/ProgrammingLanguages • Mentions

On “What was considered problematic with unsigned numeric data types?”

In languages that have both, it can unfortunately be very easy to "carelessly convert between signed/unsigned types". Also, you're often working with multiple libraries whose authors may have had different ideas on which to use, and dealing with the interactions between the two is a pain. From the point of view of language *implementers*, the additional types are a pain, too. There's a recording of a C++ conference panel available where Bjarne Stroustrup (inventor of C++) and the two other panelists all agreed unsigned types are problematic: > <Questioner> Second question, to Bjarne: Could you elaborate on not using > unsigned ints, unsigned types, unless you want to do bit arithmetic? B…
20View on Reddit

u/matthieumin r/ProgrammingLanguages • Mentions

On “C3: Handling casts and overflows part 1”

> I'll argue the opposite for the overflow point, though. Assuming you have a language that traps on overflow, being prone to overflow is a boon -- it's much rather find out about my off-by-one error where it happened instead of accidentally hobbling along for a while with a weird negative number I wasn't expecting. My problem with that is that overflow checking is dumb, in that it triggers on _intermediate_ expressions. This means that overflow checking wrecks commutativity, which is a purely artificial constraint. As example, consider an index computation where `x` and `y` are indexes, and the result is expected to be an index -- and therefore all 3 should be >= 0: x - y + 1 (>= 0)…
1View on Reddit