From: Daniel J S. <dan...@ie...> - 2004-07-26 20:23:27
|
Ethan Merritt wrote: >On Saturday 24 July 2004 07:44 pm, Daniel J Sebald wrote: > > >>typedef enum H_JUSTIFY { >> H_LEFT, >> H_CENTRE, >> H_RIGHT >>} H_JUSTIFY; >> >>typedef enum JUSTIFY { >> LEFT, >> CENTRE, >> RIGHT >>} JUSTIFY; >> >> >> > >Be careful if you consolidate these admittedly redundant definitions. > >Some of them depend on the ordering of the enums, >which of course entirely violates the spirit of using an enum >in the first place. > >For example, see this alarming comment in term_api.h > >/* this order means we can use x-(just*strlen(text)*t->h_char)/2 if > * term cannot justify > */ >typedef enum JUSTIFY { > LEFT, > CENTRE, > RIGHT >} JUSTIFY; > > Ah, geepers... There is nothing wrong with doing that, I think. But that bit of code should be changed to /* this assignment means we can use x-(just*strlen(text)*t->h_char)/2 if * term cannot justify */ typedef enum JUSTIFY { LEFT = 0, CENTRE = 1, RIGHT = 2 } JUSTIFY; But either way, a blind replacing of LEFT by H_LEFT, etc. wouldn't change the order of anything. Dan |