Showing posts with label c++. Show all posts
Showing posts with label c++. Show all posts

2007-03-28

Three jewels

This one is, I guess, going to be another classic in a few years. Andrei Alexandrescu stated in comp.lang.c++.moderated:
Well, for my money, using iostreams already puts the code in a low quality bracket :o).

The thread was about how people are dogmatic regarding the goto statement, so here are two more links:

2006-11-27

C, C++ and width of integer types

Perpetual problem with C and C++ programming is very loose specification of integer types (eg. int must be at least 16 bits, without upper limit, long has to be at least 32 bits and not smaller than int). C99 solved this problem by introducing the <stdint.h> header.

The problem could have been solved by redefining the register keyword to mean:
  • register short: half of target architecture's register width
  • register int: register width
  • register long: double the register width

I wonder how many programs would break, esp. if the register keyword would be no-op if its use would violate the minimum requirements for integer types (short, int: at least 16 bits, long: at least 32 bits).

I don't how useful would this redefinition be. Afterall, C99 does include "fast" integer types. Hm. Any opinions?