From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,30e368bdb3310fe5 X-Google-Attributes: gid109fba,public X-Google-Thread: fac41,af40e09e753872c X-Google-Attributes: gidfac41,public X-Google-Thread: f8c65,30e368bdb3310fe5 X-Google-Attributes: gidf8c65,public X-Google-Thread: 1014db,30e368bdb3310fe5 X-Google-Attributes: gid1014db,public X-Google-Thread: 1008e3,30e368bdb3310fe5 X-Google-Attributes: gid1008e3,public X-Google-Thread: 10db24,30e368bdb3310fe5 X-Google-Attributes: gid10db24,public X-Google-Thread: 103376,30e368bdb3310fe5 X-Google-Attributes: gid103376,public From: tknarr@xmission.com ( Todd Knarr ) Subject: Re: Hungarian notation Date: 1996/01/09 Message-ID: <4csi2t$gsa@news.xmission.com>#1/1 X-Deja-AN: 134548094 references: <30C40F77.53B5@swsbbs.com> <30EF0415.6FE1@tus.ssi1.com> <1996Jan7.045815.8676@ohstpy> <4cpb00$nqk@news.xmission.com> <4crm6i$24mi@navajo.gate.net> organization: Chaos Central reply-to: tknarr@xmission.com ( Todd Knarr ) newsgroups: comp.lang.eiffel,comp.lang.ada,comp.edu,comp.lang.c,comp.lang.c++,comp.lang.modula2,comp.lang.modula3 Date: 1996-01-09T00:00:00+00:00 List-Id: In <4crm6i$24mi@navajo.gate.net>, feathers@gate.net (Michael Feathers) writes: >I've never seen a variable that can be any of 9 different types in C++. >All variables have a type. Period. A type can be a union or a base >class, but all variables have one and only one type in C++. If you don't >believe me, check the ARM. You haven't worked with polymorphic classes as reference arguments or pointers much, then. I have the following class heirarchy: Stall AvailableStall AssignedStall OccupiedStall DirtyStall BeingCleanedStall BrokenStall OutOfServiceStall AlarmStall OfflineStall That's 9 subclasses of Stall. I do, though, routinely have arguments that are pointers or references to Stall. The actual object may be any one of those 9 subclasses. Give me an HN prefix that tells me that, in the following prototype Stall *HardwareChangeSignalled( Stall& ExistingStall, int ByteCount, unsigned char *aHardwareData ); the ExistingStall argument is one of the 9 subclasses and never a Stall, and the returned pointer is one of the 9 subclasses and never a pointer to Stall. Without such a prefix, you can readily get the obnoxious situation of a new programmer depending on the prefix and not realizing that he is dealing with a polymorphic type. This can cause him problems if he refers to the source code for Stall, depending on the HN prefix to be the actual type. -- Todd Knarr : tknarr@xmission.com | finger for PGP public key | Member, USENET Cabal Seriously, I don't want to die just yet. I don't care how good-looking they are, I! don't! want! to! die!" -- Megazone ( UF1 )