| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Coding style |
JT> fread (
JT> s[r[i]->target].typeid,
JT> sizeof (short int), 1, f );
JT> Would this be a better idea:
JT> fread (
JT> s[r[i]->target].typeid,
JT> sizeof (short int), 1, f
JT> );
IMNSHO, both are somewhat unreadable. :-)
fread(
s[r[i]->target].typeid, /* can't we clean this one up? */
sizeof(short int), /* short int is the same as just short */
1,
f
);
Well, that's better, but...
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.
---
* Origin: Tanktalus' Tower BBS (1:250/102)SEEN-BY: 396/1 622/419 632/107 633/260 267 270 371 634/397 635/506 728 SEEN-BY: 670/213 218 @PATH: 250/102 201 99 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™.