I *know* my CPU has opcodes that can do this - when adding (or subtracting) there is a carry flag that can be invoked to make the result essentially 1 bit longer than the data size used in calculations.
When multiplying two numbers, the CPU automatically returns a double width result.
c & c++ give programmers these bloody ridiculous integer types of undetermined size and no really optimal way to even build a variable width number library without resorting to platform specific assembler code.
I know that c & c++ have built a lot of their success on the many many many CPUs other than x86 that they target, but really, this inability to write portable code that deals with large numbers relaibly (& quickly) is a bit of a pain.. And lets not forget the pre and post increment operators owe their existance to assembly language level features of the first CPU a c compiler was developed for (at least, so Ive been led to believe).
The 6502 processor in my Vic20 had these basic features more than 20 years ago. Its not like carry flags and double width multiplaction results are novel or new ideas.
/rant
When multiplying two numbers, the CPU automatically returns a double width result.
c & c++ give programmers these bloody ridiculous integer types of undetermined size and no really optimal way to even build a variable width number library without resorting to platform specific assembler code.
I know that c & c++ have built a lot of their success on the many many many CPUs other than x86 that they target, but really, this inability to write portable code that deals with large numbers relaibly (& quickly) is a bit of a pain.. And lets not forget the pre and post increment operators owe their existance to assembly language level features of the first CPU a c compiler was developed for (at least, so Ive been led to believe).
The 6502 processor in my Vic20 had these basic features more than 20 years ago. Its not like carry flags and double width multiplaction results are novel or new ideas.
/rant
Comment