🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #57

Typedefing built in data types

#57
From: Jonatan Kutchinsky
Date: Tue, 03 Nov 1992 09:34
22 lines
1718 bytes
We are writing a program in C as a computer science project, where we
simulate a Motorola 68000 processor. We decided decided to typedef the
built in types char, short, and long to new names, BYTE, WORD, and LWORD.

The reason why we want to do this, is that we want to emphasize the
difference between the data used to control the simulation, etc.,
and the data that the simulated microprocessor is processing. We are using
ints, chars and longs to do everything else than containing data from the
simulated memory and registers, and while it is processed by instructions.

The problem is that our teacher has the opinion that this use of typedef is
a bad thing, and that it makes the program less readable when you do not
know that LWORD really stands for long, without looking in the header file.

I would like to hear some opinions on this.

Does anyone know any textbook examples using techniques similar to ours? I've
used the method several times in C programs, and find it useful.

*****************************************************************************
        Jonatan Kutchinsky, Copenhagen, Denmark. E-mail: jkut@diku.dk
*****************************************************************************
Technical Details
Message-ID: <1992Nov3.093404.9124@odin.diku.dk>
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!emory!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!mcsun!sunic!dkuug!diku!jkut

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!emory!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!mcsun!sunic!dkuug!diku!jkut
From: jkut@diku.dk (Jonatan Kutchinsky)
Newsgroups: comp.std.c
Subject: Typedefing built in data types
Message-ID: <1992Nov3.093404.9124@odin.diku.dk>
Date: 3 Nov 92 09:34:04 GMT
Sender: jkut@ask.diku.dk
Organization: Department of Computer Science, U of Copenhagen
Lines: 22