Is this bad programming?

Leif Andrew Rump andrew at resam.dk
Wed Aug 8 20:06:14 AEST 1990


Well I know it doesn't look smashing but instead of writing:

#define	FILE_FOOTER_ERROR		1
#define	DRAW_FOOTER_ERROR		2
#define	GRAP_FOOTER_ERROR		3
#define	BASE_FRAME_CREATE_ERROR		4

char	errortext[][40] = {
/*00*/	"234567890123456789012345678901234567890",
/*01*/	"File footer error",
/*02*/	"Draw footer error",
/*03*/	"Grap footer error",
/*04*/	"Base_frame creation error",
	}

which I may write wrong because I forget a line or add a line.
This is allowed by my compiler (I figure the preprocessor
removes it and performs symbol substitution before giving it
to the compiler) and I know that all the lines are there!

char	errortext[][40] = {
	"234567890123456789012345678901234567890",
#define	FILE_FOOTER_ERROR		1
	"File footer error",
#define	DRAW_FOOTER_ERROR		2
	"Draw footer error",
#define	GRAP_FOOTER_ERROR		3
	"Grap footer error",
#define	BASE_FRAME_CREATE_ERROR		4
	"Base_frame creation error",
	}

I am a pascal-programmer (aha, that is why  :-)  ) in my
real life and I could also use union/enumerated types.

Leif Andrew


Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark
UUCP: andrew at ambra.dk, phone: +45 39 27 11 77                /
Currently at Scandinavian Airline Systems                =======/
UUCP: andrew at resam.dk, phone: +45 32 32 22 79                \
SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark

> > Read oe as: o <backspace> / (slash) and OE as O <backspace> / (slash) < <



More information about the Comp.lang.c mailing list