Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Data-driven template-generation and fancy macros |
| Date | 2015-09-20 23:45 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87oagwaewb.fsf@bsb.me.uk> (permalink) |
| References | <4b733f9c-1913-4a88-ac06-b34d104b9922@googlegroups.com> <slrn3vfsmvu4tr.m0.ike@iceland.freeshell.org> |
Ike Naar <ike@iceland.freeshell.org> writes:
> On 2015-09-19, luser droog <luser.droog@gmail.com> wrote:
>> int_least32_t *ucs4_utf8(char *str, int n){
>> char *p=str;
>> int_least32_t *u,*buf=u=malloc(n*sizeof*u);
>
> Just curious: what is the purpose of 'u'?
Always assuming these are not rhetorical questions... it's the pointer
that's used to move through the array. You can't tell at all easily
because the code is not designed to be understood.
>> if (buf) {
>>
>> for (;*p;p++) {
>> if (0); UCS_RANGE(UTF_CASE)
>
> Just curious: what is the purpose of 'if (0);' ?
It lets all all of the other cases be the same. By pre-pending a dummy
case, all of the others can have the form "else if (C) S".
I don't really understand the rules of the game here so it would be
churlish to say it's ghastly code. It's probably very good code by
whatever criterion is in play here. I just don't know what that
criterion is.
<snip>
--
Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Data-driven template-generation and fancy macros luser droog <luser.droog@gmail.com> - 2015-09-19 15:46 -0700
Re: Data-driven template-generation and fancy macros Ike Naar <ike@iceland.freeshell.org> - 2015-09-20 20:12 +0000
Re: Data-driven template-generation and fancy macros luser droog <luser.droog@gmail.com> - 2015-09-20 15:11 -0700
Re: Data-driven template-generation and fancy macros Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-20 23:45 +0100
Re: Data-driven template-generation and fancy macros luser droog <luser.droog@gmail.com> - 2015-09-24 18:17 -0700
csiph-web