[Freeciv-Dev] Re: PATCH: load_map_data macro (PR#1012)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Oct 15, 2001 at 03:10:17AM -0400, Jason Dorje Short wrote:
> Raimar Falke wrote:
> >
> > On Sun, Oct 14, 2001 at 10:45:21PM -0400, Jason Dorje Short wrote:
> > > Raimar Falke wrote:
> > > >
> > > > On Sat, Oct 13, 2001 at 04:36:08PM -0700, jdorje@xxxxxxxxxxxxxxxxxxxxx
> > > > wrote:
> > > > > The attached patch implements a LOAD_MAP_POS macro. It then makes
> > > > > code
> > > > > replacement like replacing
> > >
> > > > > +static const char dec2hex[] = "0123456789abcdef";
> > > >
> > > > hex2dec and dec2hex may not be the best names. What about print_hex
> > > > and scan_hex (parse_hex)? These method are just short and much more
> > > > faster versions of sprintf and sscanf.
> > >
> > > hex2dec and dec2hex as they are now are correctly named, I think. They
> > > don't compare to sprintf and sscanf; they convert a hex to/from a
> > > character rather than a string. Or perhaps I don't quite understand
> > > what you're saying?
> >
> > dec2hex is wrong. It isn't the converting between two number systems
> > but rather a binary2ascii_hex. One side of the convertion is a
> > hex string/char and the other is a number in the internal
> > representation of the computer. This internal number doesn't have a
> > number system. It isn't decimal.
>
> Good points.
>
> So what would you name them? I think hex_chars[] is a good name for the
Ack.
> array (matching terrain_chars[]). For the others:
>
> - bin2ascii_hex, ascii_hex2bin
This one. And now somebody will shout: Raimar takes always the longer
method names ;)
> - bin2hex, hex2bin
> - bin2ascii, ascii2bin
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
Windows: Where do you want to go today?
Linux: Where do you want to go tomorrow?
BSD: Are you guys coming or what?
|
|