Return to BSD News archive
Newsgroups: comp.os.386bsd.bugs Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!noc.near.net!uunet!psinntp!uuneo!sugar!peter From: peter@NeoSoft.com (Peter da Silva) Subject: Re: ctype.h Bug & Fix Organization: NeoSoft Communications Services -- (713) 684-5900 Date: Fri, 16 Jul 1993 12:12:50 GMT Message-ID: <CA9B9F.Gx5@sugar.NeoSoft.COM> References: <CA69Fo.Lwv@bi-link.owl.de> Lines: 18 In article <CA69Fo.Lwv@bi-link.owl.de> martin@bi-link.owl.de (Martin Husemann) writes: > #define toupper(c) (islower(c)?((c) - 'a' + 'A'):(c)) > #define tolower(c) (isupper(c)?((c) - 'A' + 'a'):(c)) Be nicer to make it 2-step: > #define _toupper(c) ((c) - 'a' + 'A') > #define _tolower(c) ((c) - 'A' + 'a') > #define toupper(c) (islower(c)?_toupper(c):(c)) > #define tolower(c) (isupper(c)?_tolower(c):(c)) Since _to* avoids that extra test. It's probably not in the standard (I don't have it on hand) but it's a common idiom. -- Peter da Silva. <peter@sugar.neosoft.com>. `-_-' Hefur pu fadmad ulfinn i dag? 'U` "Det er min ledsager, det er ikke drikkepenge."