On Mon, Jan 25, 2016 at 09:27:15AM +0100, Didier Kryn wrote: [cut]
> > The following works in plain old C: > > #include <stdio.h> > #include <string.h> > static void print_start(char const *name, char const *what) > { > unsigned name_len, what_len, total; > > name_len = strlen(name); > what_len = strlen(what); > total = name_len + what_len + 3; > { > char buf[total], *p=buf; > memcpy(p, name, name_len); > p += name_len; > *p++ = ' '; > memcpy(p, what, what_len); > p += what_len; > *p++ = ':'; > *p = ' '; > *buf &= ~0x20; > > Write(2, buf, total); > } > } > > Embedded subprograms have other use cases. In long programs, > they allow to declare variables with a limited scope, just near > where they are used. I would say that having embedded subprograms in a function is not the best thing one can do in C, but that's maybe a matter of preference :) HND KatolaZ -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] _______________________________________________ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng