Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: iso646.h Date: Sat, 27 Jan 2024 17:31:42 -0800 Organization: None to speak of Lines: 19 Message-ID: <87fryi1bwh.fsf@nosuchdomain.example.com> References: <87frym7l3p.fsf@nosuchdomain.example.com> <41btN.183056$yEgf.182064@fx09.iad> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="8434623738c8ca97fb8c62709c865b07"; logging-data="3795946"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184HQMCWV3SSeKocsbLO0Yr" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:ahkHdXXOR6yOFaxmYprawfK3UJU= sha1:Ixu7NKfh3qRWahIFF/jhJ0mXL4I= Xref: csiph.com comp.lang.c:381093 David Brown writes: > For my own use, I've sometimes used classes letting you do : > > debug_log << "X = " << x << " = 0x" << hex(x, 8) << "\n"; > > "hex(x, 8)" returns a value of a class holding "x" and the number of > digits 8, and then there is an overload for the << operator on this > class. No extra state needs to be stored in the logging class, I can > make as many of these formatters as I like, and the intermediary > classes all disappear in the optimisation. Or hex() could just return a std::string. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Medtronic void Void(void) { Void(); } /* The recursive call of the void */