From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7b65fc33a05f24b6 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe19.iad.POSTED!4a71828c!not-for-mail From: Hyman Rosen User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A curiosity... References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@WWWSpace.NET NNTP-Posting-Date: Thu, 04 Dec 2008 22:57:25 UTC Date: Thu, 04 Dec 2008 17:57:24 -0500 Xref: g2news1.google.com comp.lang.ada:2883 Date: 2008-12-04T17:57:24-05:00 List-Id: Randy Brukardt wrote: > Every C-language interface that I've every used is > full of hacks to get around strong typing. > ... > Perhaps C programmers are so used to cruft that they > fail to abstract it away properly, but that reflects > more on the programmers (and the culture that they > work it) than the language. I don't think that's particularly fair, or right. The main issue that the sample exposes is that when you have a library which needs to accept user objects and pass them back into user code, it's going to be difficult to define the interface properly without a lot of mechanism. It really is the case that all pthread_create wants to do with that pointer is hand it back once it starts the thread. I expect that in modern C++, this would get wrapped in template code to make sure that the type of the pointer passed matches the argument type of the thread function, and I guess Ada would use generics similarly, but in a C interface, you just do the cast and leave it at that.