Groups | Search | Server Info | Keyboard shortcuts | Login | Register
| Message-ID | <551C7043.1010408@verizon.net> (permalink) |
|---|---|
| Newsgroups | comp.std.c++ |
| From | James Kuyper <jameskuyper@verizon.net> |
| Subject | Re: Macro replacement interpretation |
| Organization | Self |
| References | <meiemi$vtj$1@dont-email.me> <RdednfuKHuOQRonInZ2dnUVZ8kednZ2d@giganews.com> <mf8vtn$bp4$1@dont-email.me> <551990B5.3000601@verizon.net> <HIKdnYyUVLGDiYbInZ2dnUVZ7tudnZ2d@giganews.com> |
| Date | 2015-04-02 13:24 -0600 |
On 04/01/2015 06:38 PM, Jakob Bohm wrote: > > On 31/03/2015 23:38, James Kuyper wrote: > >> >> On 03/30/2015 02:21 PM, Edward Diener wrote: >> >>> >>> On 3/29/2015 5:01 AM, Jakob Bohm wrote: ... >>>> Thus it might be >>>> cumbersome to use the standard syntax to implement >>>> int printf(const char *fmt, ...) as a macro that invokes >>>> int fprintf_private(FILE *f, const char *fmt, size_t fmtlen, ...). ... >> In order for printf() to be defined as macro that calls >> fprintf_private() while allowing it be called with only a format string >> (as is legal), it would have to look something like this: >> >> // Remove any pre-existing #define of printf() by the implementation. >> #undef printf >> #define printf(...) fprintf_private(stdout, \\ >> count_va_args(#__VA_ARGS__), __VA_ARGS__) >> >> > Naah, I wanted to pass the length of the format string (in chars), not > the argument count, to illustrate use of the actual last mandatory > argument. In that case, then it's much simpler: replace count_va_args() with sizeof or strlen(). The only clue in your message was the fact that the parameter's name was "fmtlen". > Which was exactly my point. I was responding to Edward Diener, explaining your point. I often do that if the person who made the point hasn't gotten around to responding yet. I apologize if you would have preferred to explain it yourself - I sometimes get impatient - but sometimes such arguments carry more weight if they are made by multiple people. Sometimes it helps to explain the same thing multiple different ways. -- [ comp.std.c++ is moderated. To submit articles, try posting with your ] [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Next in thread | Find similar
Macro replacement interpretation Edward Diener <eldiener@tropicsoft.invalid> - 2015-03-26 12:09 -0600
Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-03-27 14:07 -0600
Re: Macro replacement interpretation Jakob Bohm <jb-usenet@wisemo.com> - 2015-03-29 03:01 -0600
Re: Macro replacement interpretation Francis Glassborow <francis.glassborow@btinternet.com> - 2015-03-30 12:20 -0600
Re: Macro replacement interpretation Edward Diener <eldiener@tropicsoft.invalid> - 2015-03-30 12:21 -0600
Re: Macro replacement interpretation Francis Glassborow <francis.glassborow@btinternet.com> - 2015-03-31 15:39 -0600
Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-04-01 16:39 -0600
Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-03-31 15:38 -0600
Re: Macro replacement interpretation Jakob Bohm <jb-usenet@wisemo.com> - 2015-04-01 16:38 -0600
Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-04-02 13:24 -0600
Re: Macro replacement interpretation Francis Glassborow <francis.glassborow@btinternet.com> - 2015-04-03 14:30 -0600
Re: Macro replacement interpretation Edward Diener <eldiener@tropicsoft.invalid> - 2015-04-03 14:30 -0600
Re: Macro replacement interpretation James Kuyper <jameskuyper@verizon.net> - 2015-04-04 15:50 -0600
csiph-web