Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ukma!husc6!purdue!decwrl!csdpie.dec.com!vilot From: vilot@csdpie.dec.com (Michael J. Vilot) Newsgroups: comp.lang.c++ Subject: RE: object data type Message-ID: <8812301705.AA14595@decwrl.dec.com> Date: 30 Dec 88 17:05:28 GMT Organization: Digital Equipment Corporation Lines: 36 > I am curious if anyone has a problem with the fact that c++ has a mixture of > object data types, and standard C data types. I have just been looking at > smaltalk and its philosophy of 'everything is an object'. This turns out to be an interesting question. What you'll find in SmallTalk _implementations_ are special optimisations for "primitive" data types (e.g. integers) to make them efficient enough for traditional hardware. C++ inherits C's "systems programming" orientation, and naturally implements these "primitive" types efficiently: "Features that would incur run-time or memory overheads even when not used were avoided. For example, ideas that would make it necessary to store ``housekeeping information'' in every object were rejected; if a user declares a structure consisting of two 16-bit quantities, that structure will fit into a 32-bit register." -- The C++ Programming Language, p. 3 > [ question on generic queue ] > how does one work on datatypes such as integers, > or doubles etc. Does one have to create a function that converts all defined > datatypes to objects? Not _all_. Implicit and explicit conversions can simplify matters. The arithmetic conversions of R6.6 (p. 253) are defined to cope with the built-in types. You can provide explicit conversions [R7.2.3, p. 258] in any user-define classes. Take the trouble to learn the conversion rules. Like the operator precedence hierarchy, a clear understanding of them can often simplify your code. == Mike Vilot e-mail: vilot%ontologic@erl.mit.edu or: vilot%keeper.dec@decwrl.dec.com when that fails: (508)467-6166 [for now]