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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4215feeab2a8154a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!c14g2000yqm.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: C++0x and Threads - a poor relation to Ada's tasking model? Date: Wed, 12 Aug 2009 00:26:51 -0700 (PDT) Organization: http://groups.google.com Message-ID: <81a101a3-b46e-4268-973c-356c6119ee2b@c14g2000yqm.googlegroups.com> References: <7q2385104kihs87d79p8kfphuoki6r01vq@4ax.com> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1250062011 20369 127.0.0.1 (12 Aug 2009 07:26:51 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 12 Aug 2009 07:26:51 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c14g2000yqm.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.13) Gecko/2009073021 Firefox/3.0.13,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7690 Date: 2009-08-12T00:26:51-07:00 List-Id: On 12 Sie, 01:53, jimmaureenrog...@worldnet.att.net wrote: > My objection, which was not considered > significant, was that the compilers have less information for > checking the correctness of library calls than they do of checking > the syntax of reserved words. As long as the library calls are based on *standard* API there is nothing that could prevent the compiler from applying some special treatment to these calls. The reasoning is that any library call that is recognized as a standard call (for example by namespace or package prefix) is essentially a keyword that can attract the attention of the compiler. A very simple example is the printf function, which is inherently unsafe as it does not provide any type checking for its parameters. This does not prevent the gcc (or g++) compiler from actually checking them anyway: #include int main() { int s = 1234; std::printf("%s\n", s); } ~/temp/cpp $ g++ -Wall hello.cpp hello.cpp: In function 'int main()': hello.cpp:5: warning: format '%s' expects type 'char*', but argument 2 has type 'int' ~/temp/cpp $ Above, std::printf, even though not formally a keyword, has attracted the compiler's attention and allowed it to perform type checks that are not mandated by the language itself. Can you give an example of correctness checking in the area of multithreading that is possible with reserved words and that is *certainly* not possible with library calls? -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada