TIP: Click on subject to list as thread! ANSI
echo: public_domain
to: Rod Speed
from: Paul Edwards
date: 1994-02-26 08:44:40
subject: extensions to ISO C

RS> Mi Gaard, you do understand how the standards committees work I presume ?
 RS> |-) Or are you proposing that what you thrash out gets presented to them
 RS> for inclusion ?

Well I'll make a PD standard, and send a copy to PJ Plauger, and he can do
what he likes with it.

 PE>> For instance, what do the rest of you do after you've done an fgets
 PE>> and you need to strip the newline character from the end of the
 PE>> string?  And quite often, after that, you want to strip trailing
 PE>> whitespace.  Well I have functions strinl() and stritr() which do
 PE>> these two functions.

 RS> Presumably you mean they actually call fgets themselves. Yeah, thats the
 RS> way I do stuff like that. The code which uses them looks clean. The
 RS> detail of how they get the line is hidden in the traditional way.

No.  I do an fgets, then I do a strinl, then I do a stritr.

 PE>> So does everyone want to adopt these 2 functions in their own code?
 PE>> If not, why not, and what do you use instead, and maybe I'll start
 PE>> using that too.

 RS> The main problem is that those are pretty good candidates but that there
 RS> is lots as well thats done on occasion and its hard to decide just when
 RS> its used enough to have standardised.

Well we'll start with the widely used, and work our way down.

 RS> And on a more fundamental point, thats essentially what Awk its but
 RS> going much further. And IMO a better route, tho its far from perfect.
 RS> IMO whats really needed is more enhancement of Awk and more particularly
 RS> some mechanism which allows a more blurred boundary between Awk and C
 RS> than there is now so you arent left with the problem that when a
 RS> particular task isnt quite suitable for Awk, the alternative is lots
 RS> more work in C instead.

Or maybe 4GL, or maybe SAS, or maybe a spreadsheet.  I'm talking about C
programs here.

 PE>> #define comp1(a,b) memcmp(a, b, sizeof a)
 PE>> #define comp2(a,b) memcmp(a, b, sizeof b)

 RS> And if you are going use those names, the compN style is awful for a
 RS> name, not enough meaning in the name for a memory jogger. Tho the digit
 RS> use isnt bad itself.

The comp() and move() macros get used commonly enough that you get used to
them.  What would you like them called anyway?  BFN.

Paul

--- GoldED/2 2.42.G1114
* Origin: Ten Minute Limit (3:711/934)

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™.