Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.c,comp.programming.threads Subject: Re: Trivial C11 threads.h wrapper (public domain) Date: Mon, 01 Oct 2012 14:38:12 -0400 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: <50643C6A.6020609@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 1 Oct 2012 18:38:18 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="ffb8f7085759b339c1002252b48331a4"; logging-data="18907"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cwjRjzgc7PFV5HZRL3ixE" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 In-Reply-To: Cancel-Lock: sha1:ipGjsFlZb4xJPJkrpGxayVeE/RE= Xref: csiph.com comp.lang.c:26932 comp.programming.threads:1153 On 10/1/2012 2:19 PM, Toby Douglass wrote: > In article <50643C6A.6020609@web.de>, Markus.Elfring@web.de says... >> 1. Would you like to provide a "typedef" for each enumeration? > > Enums have a type already and can only take a value in their range. An enum has a type, yes, but a variable of that type is not range-restricted. enum { FOO=1, BAR=2 } x; x = 42; // legal Some see this as a flaw in C, and I'd have to agree that C's enums are sort of half-baked. However, it allows things like enum { COMMAND=1, DATA=2, STROBE=0x40, RESET=0x80 } flags; flags = STROBE | DATA; > What's the advantage of a typedef? the disadvantage is extended the > type space. In this instance it's moot. The source under discussion tries to mimic C11 thread support for systems that lack C11 but have Pthreads. As a C11 imitation, it should not introduce gratuitous identifiers not called for by the C11 Standard. (Some, of course, are unavoidable: The Pthreads-related headers declare names that the C11 Standard reserves for the programmer's use, and some of those even have external linkage.) -- Eric Sosman esosman@ieee-dot-org.invalid