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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!195.208.113.67.MISMATCH!goblin1!goblin.stu.neva.ru!news.tornevall.net!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Tue, 08 Feb 2011 11:30:51 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <8r86vgFc3uU1@mid.individual.net> <19fh1chm74f9.11cws0j5bckze.dlg@40tude.net> <4d4ff70e$0$6886$9b4e6d93@newsspool2.arcor-online.net> <737a6396-72bd-4a1e-8895-7d50f287960e@d28g2000yqc.googlegroups.com> <4d5008a5$0$6879$9b4e6d93@newsspool2.arcor-online.net> <4d5031fe$0$6765$9b4e6d93@newsspool3.arcor-online.net> <1f229967-d3cf-42b6-8087-c97ee08652f3@i40g2000yqh.googlegroups.com> <4d51169e$0$7657$9b4e6d93@newsspool1.arcor-online.net> NNTP-Posting-Host: f5c8cf87e133e8fda81759dbd4cda1ea Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 6d1ca961367d1523f9aa1c47f66e2544 X-Complaints-To: abuse@tornevall.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-UserIDNumber: 1738 X-Validate-Post: http://news.tornevall.net/validate.php?trace=6d1ca961367d1523f9aa1c47f66e2544 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news1.google.com comp.lang.ada:17011 Date: 2011-02-08T11:30:51-07:00 List-Id: On 02/08/2011 03:14 AM, Ludovic Brenta wrote: > > No. Stupid programmers use "int" when they really mean "positive", and > they don't even explain that to users of their APIs. Not even in > comments. Then they say bugs are every one else's fault but theirs. From the Ada mind-set point of view, this is correct. But in the C mind set, there are no APIs. Header files are just complications you have to create to keep the compiler happy; nobody reads them, and they're generally not commented or formatted nicely. You are expected (and all C coders expect) that before using a function, you have read and understand its code and know what it will do. I once worked on an Ada project that had been done by C people. The package specs were badly formatted collections of declarations with no comments; the developers viewed them as header files that no one would read. There were minimal comments in the bodies, and everyone was expected to read the body code to understand how to use the operations. The problem with this is it violates Dijkstra's adage that we have small brains and must do our work with them. Few of us can keep all the code for the entire project in his head, and there are times when what one remembers is incorrect. And so, eventually, in any real project, even the best of developers make errors under such circumstances. So, when talking to a C coder, "You said int, so negative values should be OK" isn't considered a valid argument. The response will be that you are supposed to have read the code and realized what would happen if you called it with a negative value. If you then go ahead and do so, you get what you asked for. -- Jeff Carter "Mr. President, we must not allow a mine-shaft gap!" Dr. Strangelove 33