June 2, 2000

Prefer Prefix Operators to Postfix Ones for Non-Fundamental Types

Postfix operators, namely ++ and –, are less efficient than their prefix counterparts because the compiler usually creates a temporary copy of the object before applying the operator to an object. When using fundamental types such as int or char, most compilers can optimize the code and eliminate the performance

Reducing A Class’s Size

Many programmers still use the non-standard, platform dependent BOOL typedef instead of using bool. There are many good reasons why you shouldn’t use BOOL; one of them has to do with the size of this type. Unlike bool, which occupies one byte on most platforms, BOOL occupies four bytes. Thus,

What’s a Constant Expression?

In several occasions, C++ requires the use of integral constant expressions, for instance: array bounds, case expressions, bit-field lengths, and enumerator initializers must all be integral constant expressions. An integral constant expression is one of the following: A numeric literal: x s; // a template argument Sizeof expressions: sizeof (int);

Fastest Minimum-Width Integer Types

Another set of typedef names for integer types defined in < inttypes.h > is called “fastest minimum-width integer types.” Each of these typedef names designates aninteger type that is usually fastest to operate with among all integer types that have at least the specified width. They have the general form

Integers With Platform-Independent Width

The newly approved C99 standard defines a new header file called < inttypes.h >, which defines sets of typedef names for integer types. One of these sets defines integer types having certain exact widths: int8_t int16_t int32_t int64_t And their exact-width unsigned counterparts are: uint8_t uint16_t uint32_t uint64_t The names

Dynamically Convert HTML to WML

Question: How do I dynamically convert HTML to WML? I would like to take data from, say, a stock-quote page, strip it, and display the info in WML. Answer: Some tools might be able to do the majority of the gruntwork, but no easy content-management system is publically available yet.

Limit Your Resultset with TOP or SET ROWCOUNT

ou’re probably familiar with the typical “SELECT * FROM Table” SQL statement, which returns all the records in a table. By adding a WHERE clause to a SELECT statement, you limit the resultset to only those records that match the WHERE criteria. Although this may or may not limit the

Implementing Enumerated Types in Java

lthough Java syntax borrowed heavily from C++, there are many C++ featuresthat Java chose to omit. At times, the lack of a particular featuremakes Java programs cumbersome to implement. One such feature isthe ability to define enumerated types, such as those declared with theC++ enum keyword. An enumerated type can

Building a Text Editor, Part III

n this article, you’ll continue building on the text editor that you created in Part I and Part II. As usual, the code is available for download by clicking here. This article will add a few more features to the application, including the ability to pick a file from the