TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Darin Mcbride
from: Robin Sheppard
date: 1998-07-01 22:13:04
subject: Coding style

> const size_t read_target = r[i]->target;
 > const short* p_typeid    = s[read_target].typeid;
 > fread(p_typeid, sizeof(*p_typeid), 1, f);
 
 > That I find to be much improved.  Just my opinion, of
 > course.
 
 JT> That might be worth considering. But it looks a bit 
 JT> messy since there is so much code to simplify one 
 JT> function call. On the other hand I use lot's of similar 
 JT> fread()s on the project that the sample was taken from.

 DM> Sometimes simpler code is shorter, sometimes it is longer.  
 DM> Interestingly, the above code should be optimizable into 
 DM> the original code, meaning it should be just as fast, and 
 DM> just as short (codesize).  So it isn't really longer to the 
 DM> CPU during runtime.  (Not that this should matter too much -
 DM> you're doing file I/O which is inherently slower than the 
 DM> memory tricks you do to generate the first parameter...)

   Ahh, but this is based on the assumption that it's not a RAMdisk that's
being read from.  

... Christian Science Programming: "Let God Debug It!".
___ Blue Wave/DOS v2.30 [NR]

--- Maximus 2.01wb
* Origin: Basic'ly Computers: Mooo-ing Right Along. (1:153/9)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 639/252 670/213 218
@PATH: 153/104 2 716 7715 140/1 270/101 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.