comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: How do I write directly to a memory address?
Date: Tue, 08 Feb 2011 11:30:51 -0700
Date: 2011-02-08T11:30:51-07:00	[thread overview]
Message-ID: <iis37l$t09$1@tornado.tornevall.net> (raw)
In-Reply-To: <db60098c-2569-4efb-aa81-253ba53686b4@y26g2000yqd.googlegroups.com>

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



  parent reply	other threads:[~2011-02-08 18:30 UTC|newest]

Thread overview: 381+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03  5:52 How do I write directly to a memory address? Syntax Issues
2011-02-03  8:00 ` Georg Bauhaus
2011-02-03  8:01   ` Georg Bauhaus
2011-02-08 13:34   ` Yannick Duchêne (Hibou57)
2011-02-03  8:08 ` mockturtle
2011-02-03 18:07   ` Jeffrey Carter
2011-02-08 13:43   ` Yannick Duchêne (Hibou57)
2011-02-08 21:07     ` Vinzent Hoefler
2011-02-10  2:21     ` Randy Brukardt
2011-02-03  8:24 ` Ludovic Brenta
2011-02-03 10:50   ` Syntax Issues
2011-02-03 11:03   ` Georg Bauhaus
2011-02-03 18:24   ` Jeffrey Carter
2011-02-04  9:21     ` Ludovic Brenta
2011-02-03 21:30   ` Florian Weimer
2011-02-04  9:24   ` Ludovic Brenta
2011-02-04 10:31     ` Georg Bauhaus
2011-02-04 11:07       ` Dmitry A. Kazakov
2011-02-04 17:35       ` Jeffrey Carter
2011-02-04 16:00     ` Hyman Rosen
2011-02-04 17:40       ` Dmitry A. Kazakov
2011-02-04 18:35         ` Hyman Rosen
2011-02-05  5:17           ` Randy Brukardt
2011-02-04 21:36       ` Shark8
2011-02-04 23:00       ` Adam Beneschan
2011-02-05  0:20         ` John B. Matthews
2011-02-05 14:56       ` Pascal Obry
2011-02-07 14:59         ` Hyman Rosen
2011-02-07 16:24           ` Robert A Duff
2011-02-07 16:44             ` Hyman Rosen
2011-02-07 17:02               ` Ludovic Brenta
2011-03-01 20:27             ` Hyman Rosen
2011-03-01 20:47               ` Dmitry A. Kazakov
2011-03-01 21:17                 ` Hyman Rosen
2011-03-01 21:37                   ` Dmitry A. Kazakov
2011-03-01 21:54                     ` Hyman Rosen
2011-03-02  8:42                       ` Dmitry A. Kazakov
2011-03-02 14:36                         ` Hyman Rosen
2011-03-02 15:30                           ` Dmitry A. Kazakov
2011-03-02 15:40                             ` Hyman Rosen
2011-03-02 16:25                               ` Georg Bauhaus
2011-03-02 16:40                                 ` Hyman Rosen
2011-03-02 18:44                                   ` Georg Bauhaus
2011-03-02 18:59                                     ` Hyman Rosen
2011-03-02 17:21                               ` Dmitry A. Kazakov
2011-03-02 17:40                                 ` Hyman Rosen
2011-03-02 18:04                                   ` Dmitry A. Kazakov
2011-03-02 18:29                                     ` Hyman Rosen
2011-03-02 21:55                                       ` Dmitry A. Kazakov
2011-03-02 22:10                                         ` Hyman Rosen
2011-03-03  8:14                                           ` Dmitry A. Kazakov
2011-03-03  8:04                                 ` Simon Wright
2011-03-03  8:23                                   ` Dmitry A. Kazakov
2011-03-03  8:50                                   ` Hyman Rosen
2011-03-03  7:54                               ` Simon Wright
2011-03-02 20:34                   ` KK6GM
2011-03-02 20:59                     ` Hyman Rosen
2011-03-02 21:03                       ` Vinzent Hoefler
2011-03-02 21:13                         ` Hyman Rosen
2011-03-02 21:34                           ` KK6GM
2011-03-03  1:09                             ` Hyman Rosen
2011-03-03  1:38                               ` KK6GM
2011-03-03  2:42                               ` Randy Brukardt
2011-03-02 23:18                           ` Vinzent Hoefler
2011-03-02 23:26                             ` Hyman Rosen
2011-03-03  0:46                               ` Edward Fish
2011-03-03  1:03                                 ` Hyman Rosen
2011-03-03  3:01                                   ` Randy Brukardt
2011-03-03  6:05                                     ` Hyman Rosen
2011-03-03  8:52                                       ` Dmitry A. Kazakov
2011-03-03 17:51                                         ` Hyman Rosen
2011-03-03 18:32                                           ` Dmitry A. Kazakov
2011-03-03 20:08                                             ` Hyman Rosen
2011-03-03 21:55                                               ` Dmitry A. Kazakov
2011-03-03 22:08                                                 ` Hyman Rosen
2011-03-03 20:34                                             ` Hyman Rosen
2011-03-04  0:22                                       ` Randy Brukardt
2011-03-04  3:21                                         ` Nasser M. Abbasi
2011-03-04 16:48                                         ` Hyman Rosen
2011-03-03 21:24                               ` Vinzent Hoefler
2011-03-03 21:32                                 ` Hyman Rosen
2011-03-03 21:39                                   ` Vinzent Hoefler
2011-03-03 21:44                                     ` Hyman Rosen
2011-03-03 22:28                                   ` Georg Bauhaus
2011-03-01 21:52               ` Pascal Obry
2011-03-01 22:08                 ` Hyman Rosen
2011-03-02  0:41                   ` Randy Brukardt
2011-03-02  2:59                     ` Nasser M. Abbasi
2011-03-03  1:44                       ` Randy Brukardt
2011-03-02 14:26                     ` Hyman Rosen
2011-03-02 14:34                       ` Ludovic Brenta
2011-03-02 14:59                         ` Hyman Rosen
2011-03-02 15:19                           ` Pascal Obry
2011-03-02 15:35                             ` Hyman Rosen
2011-03-02 15:49                           ` Ludovic Brenta
2011-03-02 16:03                             ` Hyman Rosen
2011-03-03  2:23                       ` Randy Brukardt
2011-03-03  5:48                         ` Hyman Rosen
2011-03-02  9:19                   ` Pascal Obry
2011-03-02  9:31                     ` Dmitry A. Kazakov
2011-03-02  9:45                       ` Nasser M. Abbasi
2011-03-02 10:24                         ` Georg Bauhaus
2011-03-02 11:16                         ` Dmitry A. Kazakov
2011-03-02 14:51                     ` Hyman Rosen
2011-02-06 17:49     ` Simon Clubley
2011-02-06 18:18       ` Niklas Holsti
2011-02-06 19:05         ` Simon Clubley
2011-02-06 20:01           ` Dmitry A. Kazakov
2011-02-06 21:27             ` Maciej Sobczak
2011-02-06 23:08               ` Shark8
2011-02-07  6:38                 ` Niklas Holsti
2011-02-07  7:23                   ` Shark8
2011-02-07  8:31                     ` Niklas Holsti
2011-02-07 12:31                       ` Simon Clubley
2011-02-07 12:42                         ` Simon Clubley
2011-02-07 21:54                           ` Randy Brukardt
2011-02-08  0:21                             ` Bill Findlay
2011-02-08  1:06                             ` Adam Beneschan
2011-02-21  7:17                               ` David Thompson
2011-02-08 12:46                             ` Simon Clubley
2011-02-08 13:12                             ` J-P. Rosen
2011-02-08 18:03                               ` Jeffrey Carter
2011-02-07  8:38               ` Dmitry A. Kazakov
2011-02-07  9:05                 ` Maciej Sobczak
2011-02-07  9:24                   ` Dmitry A. Kazakov
2011-02-07 23:11                     ` Maciej Sobczak
2011-02-08 18:14                       ` Dmitry A. Kazakov
2011-02-08 21:48                         ` Maciej Sobczak
2011-02-09  8:43                           ` Dmitry A. Kazakov
2011-02-09 21:07                             ` Maciej Sobczak
2011-02-09 21:38                               ` Dmitry A. Kazakov
2011-03-01 21:45                                 ` Maciej Sobczak
2011-02-07  9:00             ` Ludovic Brenta
2011-02-07 13:43               ` Georg Bauhaus
2011-02-07 13:56                 ` Ludovic Brenta
2011-02-07 14:58                   ` Georg Bauhaus
2011-02-07 15:21                     ` Dmitry A. Kazakov
2011-02-07 16:14                       ` Robert A Duff
2011-02-07 17:23                         ` Dmitry A. Kazakov
2011-02-07 18:38                         ` Jeffrey Carter
2011-02-07 21:38                           ` Robert A Duff
2011-02-07 22:41                             ` Simon Wright
2011-02-07 18:10                       ` Georg Bauhaus
2011-02-07 19:27                         ` Simon Wright
2011-02-07 19:29                         ` Dmitry A. Kazakov
2011-02-07 16:54                     ` Ludovic Brenta
2011-02-07 17:55                       ` Georg Bauhaus
2011-02-08  8:04                         ` Ludovic Brenta
2011-02-08  9:01                           ` Nasser M. Abbasi
2011-02-08  9:08                             ` Ludovic Brenta
2011-02-08  9:43                           ` Georg Bauhaus
2011-02-08 19:53                             ` Shark8
2011-02-08  9:46                           ` Georg Bauhaus
2011-02-08  9:58                             ` Ludovic Brenta
2011-02-08 10:03                               ` Georg Bauhaus
2011-02-08 10:08                                 ` Ludovic Brenta
2011-02-08 10:27                                   ` Georg Bauhaus
2011-02-08 10:15                                 ` Nasser M. Abbasi
2011-02-08 16:48                                 ` Adam Beneschan
2011-02-08 18:25                                   ` Georg Bauhaus
2011-02-08 20:48                                     ` Vinzent Hoefler
2011-02-08 21:24                                       ` Georg Bauhaus
2011-02-08 21:41                                         ` Vinzent Hoefler
2011-02-09  8:59                                           ` Dmitry A. Kazakov
2011-02-09 18:25                                             ` Vinzent Hoefler
2011-02-09 20:03                                               ` Dmitry A. Kazakov
2011-02-09 20:19                                                 ` Vinzent Hoefler
2011-02-09 21:10                                                   ` Hyman Rosen
2011-02-09 21:42                                                     ` Vinzent Hoefler
2011-02-08 17:11                             ` Pascal Obry
2011-02-08 17:11                             ` Pascal Obry
2011-02-08 17:11                             ` Pascal Obry
2011-02-08 17:24                               ` Hyman Rosen
2011-02-08 18:27                                 ` Dmitry A. Kazakov
2011-02-08 18:43                                   ` Hyman Rosen
2011-02-08 10:10                           ` Georg Bauhaus
2011-02-08 10:14                             ` Ludovic Brenta
2011-02-08 10:31                               ` Georg Bauhaus
2011-02-08 18:30                               ` Jeffrey Carter [this message]
2011-02-08 18:47                                 ` Hyman Rosen
2011-02-08 20:11                                   ` Shark8
2011-02-08 20:27                                     ` Hyman Rosen
2011-02-08 20:52                                       ` Shark8
2011-02-08 21:21                                         ` Jeffrey Carter
2011-02-08 21:35                                           ` Shark8
2011-02-09  0:03                                       ` Randy Brukardt
2011-02-09  0:14                                         ` Shark8
2011-02-10  2:51                                           ` Randy Brukardt
2011-02-10  4:30                                             ` Shark8
2011-02-11  2:16                                               ` Randy Brukardt
2011-02-09 15:34                                         ` Hyman Rosen
2011-02-09 16:15                                           ` Dmitry A. Kazakov
2011-02-09 16:43                                             ` KK6GM
2011-02-09 17:49                                               ` Dmitry A. Kazakov
2011-02-09 17:54                                                 ` Hyman Rosen
2011-02-09 18:15                                                   ` Dmitry A. Kazakov
2011-02-09 18:25                                                   ` Shark8
2011-02-09 20:16                                                   ` Simon Wright
2011-02-09 20:33                                                     ` Vinzent Hoefler
2011-02-09 16:48                                             ` Hyman Rosen
2011-02-09 17:49                                               ` Dmitry A. Kazakov
2011-02-09 18:07                                                 ` Hyman Rosen
2011-02-09 18:36                                                   ` Dmitry A. Kazakov
2011-02-09 19:12                                                     ` Hyman Rosen
2011-02-09 19:41                                                       ` Shark8
2011-02-09 20:00                                                         ` Hyman Rosen
2011-02-09 20:25                                                           ` Shark8
2011-02-09 21:20                                                             ` Hyman Rosen
2011-02-09 21:23                                                               ` Shark8
2011-02-09 21:40                                                                 ` Hyman Rosen
2011-02-09 23:59                                                                   ` Robert A Duff
2011-02-09 20:01                                                       ` Dmitry A. Kazakov
2011-02-09 20:56                                                         ` Hyman Rosen
2011-02-09 21:47                                                           ` Dmitry A. Kazakov
2011-02-09 21:51                                                             ` Simon Wright
2011-02-09 21:56                                                             ` Hyman Rosen
2011-02-09 22:01                                                               ` Dmitry A. Kazakov
2011-02-10  3:08                                                       ` Randy Brukardt
2011-02-09 22:31                                                   ` Anonymous
2011-02-09 22:34                                                     ` Hyman Rosen
2011-02-09 22:41                                                       ` Vinzent Hoefler
2011-02-09 22:52                                                         ` Hyman Rosen
     [not found]                                                 ` <4d52d7d9$0$18057$882e7ee2@usenet-news.ne t>
2011-02-10  3:03                                                   ` Randy Brukardt
2011-02-09 18:23                                               ` Shark8
2011-02-09 18:31                                                 ` Hyman Rosen
2011-02-09 19:20                                                   ` Shark8
2011-02-09 19:43                                                     ` Hyman Rosen
2011-02-09 20:29                                                       ` Shark8
2011-02-09 21:26                                                         ` Hyman Rosen
2011-02-09 21:40                                                           ` Shark8
2011-02-09 22:09                                                             ` Hyman Rosen
2011-02-09 22:23                                                               ` Shark8
2011-02-09 22:31                                                                 ` Hyman Rosen
2011-02-09 22:38                                                                   ` Vinzent Hoefler
2011-02-09 22:50                                                                     ` Hyman Rosen
2011-02-10  0:16                                                                       ` Shark8
2011-02-10 15:28                                                                         ` Hyman Rosen
2011-02-10 16:38                                                                           ` Shark8
2011-02-10 16:46                                                                             ` Hyman Rosen
2011-02-10  3:23                                                                       ` Randy Brukardt
2011-02-10 17:33                                                                       ` Vinzent Hoefler
2011-02-09 23:07                                                                   ` Shark8
2011-02-09 23:24                                                                     ` Hyman Rosen
2011-02-10  0:35                                                                       ` Shark8
2011-02-10 15:38                                                                         ` Hyman Rosen
2011-02-10 17:05                                                                           ` Shark8
2011-02-10 17:40                                                                             ` Hyman Rosen
2011-02-10 18:22                                                                               ` Shark8
2011-02-10 19:20                                                                               ` Georg Bauhaus
2011-02-11  8:26                                                                               ` Ludovic Brenta
2011-02-11 10:22                                                                                 ` Nasser M. Abbasi
2011-02-11 16:10                                                                                 ` Hyman Rosen
2011-02-11 18:04                                                                                   ` Dmitry A. Kazakov
2011-02-11 18:31                                                                                     ` Hyman Rosen
2011-02-11 18:42                                                                                       ` Vinzent Hoefler
2011-02-11 18:52                                                                                         ` Hyman Rosen
2011-02-11 20:02                                                                                           ` Vinzent Hoefler
2011-02-11 19:41                                                                                       ` Dmitry A. Kazakov
2011-02-11 18:43                                                                                   ` Vinzent Hoefler
2011-02-11 18:57                                                                                     ` Hyman Rosen
2011-02-11 20:15                                                                                       ` Vinzent Hoefler
2011-02-11 20:29                                                                                         ` Hyman Rosen
2011-02-11 20:42                                                                                           ` Vinzent Hoefler
2011-02-11 18:52                                                                                   ` Georg Bauhaus
2011-02-11 19:02                                                                                     ` Hyman Rosen
2011-02-10 17:30                                                                           ` Georg Bauhaus
2011-02-09 18:10                                             ` Shark8
2011-02-10  2:56                                           ` Randy Brukardt
2011-02-09 21:15                                         ` Anonymous
2011-02-08 19:43                                 ` Dmitry A. Kazakov
2011-02-08 20:01                                   ` Hyman Rosen
2011-02-08 20:27                                     ` Dmitry A. Kazakov
2011-02-08 20:41                                       ` Hyman Rosen
2011-02-08 21:06                                     ` Adam Beneschan
2011-02-08 21:13                                       ` Hyman Rosen
2011-02-08 21:16                                       ` Vinzent Hoefler
2011-02-08 22:41                                         ` Adam Beneschan
2011-02-09 18:39                                           ` Vinzent Hoefler
2011-02-09 20:29                                             ` Simon Wright
2011-02-09 20:44                                               ` Vinzent Hoefler
2011-02-10  3:03                                                 ` Adam Beneschan
2011-02-10 19:07                                                   ` Vinzent Hoefler
2011-02-11  7:19                                                     ` Stephen Leake
2011-02-11 18:43                                                       ` Vinzent Hoefler
2011-02-09 10:42                                         ` Simon Wright
2011-02-09 18:39                                           ` Vinzent Hoefler
2011-02-09 18:48                                             ` J-P. Rosen
2011-02-09 18:55                                               ` Vinzent Hoefler
2011-02-09 22:03                                                 ` J-P. Rosen
2011-02-09 22:25                                                   ` Vinzent Hoefler
2011-02-10  3:07                                                     ` Adam Beneschan
2011-02-10  6:09                                                     ` J-P. Rosen
2011-02-10 17:48                                                       ` Vinzent Hoefler
2011-02-09 21:30                                             ` Simon Wright
2011-02-09 22:05                                               ` Vinzent Hoefler
2011-02-09 18:42                                           ` Vinzent Hoefler
2011-02-08 21:09                                     ` Shark8
2011-02-08 21:25                                       ` Hyman Rosen
2011-02-08 21:46                                         ` Vinzent Hoefler
2011-02-08 21:59                                           ` Hyman Rosen
2011-02-09 18:44                                             ` Vinzent Hoefler
2011-02-09 18:54                                               ` Hyman Rosen
2011-02-09 18:59                                                 ` Vinzent Hoefler
2011-02-09 19:21                                                   ` Hyman Rosen
2011-02-09 19:30                                                     ` Vinzent Hoefler
2011-02-09 19:44                                                       ` Hyman Rosen
2011-02-09 20:08                                                         ` Vinzent Hoefler
2011-02-08 21:49                                         ` Simon Clubley
2011-02-08 21:51                                           ` Vinzent Hoefler
2011-02-08 22:13                                             ` Hyman Rosen
2011-02-09 18:04                                               ` Vinzent Hoefler
2011-02-08 22:12                                           ` Hyman Rosen
2011-02-08 23:03                                             ` Simon Clubley
2011-02-08 22:30                                         ` Shark8
2011-02-09 10:19                                         ` Ludovic Brenta
2011-02-09 15:09                                         ` KK6GM
2011-02-09  0:13                                       ` Randy Brukardt
2011-02-09  1:56                                         ` Shark8
2011-02-09  2:33                                           ` Adam Beneschan
2011-02-09 15:49                                             ` Hyman Rosen
2011-02-10  3:29                                               ` Randy Brukardt
2011-02-21  7:17                                             ` David Thompson
2011-02-08 20:04                                   ` Simon Clubley
2011-02-08 20:44                                     ` Dmitry A. Kazakov
2011-02-08 21:19                                       ` Simon Clubley
2011-02-09  9:21                                         ` Dmitry A. Kazakov
2011-02-09 15:20                                           ` KK6GM
2011-02-09 16:39                                             ` Hyman Rosen
2011-02-09 16:46                                               ` KK6GM
2011-02-09 17:15                                                 ` Hyman Rosen
2011-02-09 17:46                                                   ` Shark8
2011-02-09 18:02                                                   ` Dmitry A. Kazakov
2011-02-09 18:17                                                     ` Hyman Rosen
2011-02-09 18:34                                                       ` Dmitry A. Kazakov
2011-02-09 18:52                                                         ` Hyman Rosen
2011-02-09 19:48                                                           ` Dmitry A. Kazakov
2011-02-09 20:09                                                             ` Vinzent Hoefler
2011-02-09 20:52                                                             ` Hyman Rosen
2011-02-09 21:45                                                               ` Simon Wright
2011-02-09 22:13                                                                 ` Shark8
2011-02-09 18:53                                                   ` KK6GM
2011-02-09 19:20                                                     ` Hyman Rosen
2011-02-08 21:31                                       ` Shark8
2011-02-08 21:50                                         ` Vinzent Hoefler
2011-02-08 21:56                                           ` Simon Clubley
2011-02-08 22:41                                             ` Shark8
2011-02-09 18:12                                               ` Vinzent Hoefler
2011-02-09 18:29                                                 ` Shark8
2011-02-09 18:49                                                   ` Vinzent Hoefler
2011-02-09 18:36                                                 ` Hyman Rosen
2011-02-09 18:51                                                   ` Vinzent Hoefler
2011-02-21  7:17                                         ` David Thompson
2011-02-08 20:55                                   ` Georg Bauhaus
2011-02-08 21:26                                   ` Jeffrey Carter
2011-02-09  7:59                                   ` Mart van de Wege
2011-02-09  9:16                                     ` Dmitry A. Kazakov
2011-02-09 10:28                                       ` Mart van de Wege
2011-02-09 15:57                                         ` Hyman Rosen
2011-02-10  3:36                                           ` Randy Brukardt
2011-02-10  6:35                                             ` J-P. Rosen
2011-02-08 10:11                           ` Georg Bauhaus
2011-02-08 10:16                             ` Ludovic Brenta
2011-02-08 10:36                               ` Georg Bauhaus
2011-02-08 10:43                                 ` Ludovic Brenta
2011-02-08 12:20                                   ` Georg Bauhaus
2011-02-08 20:21                             ` Shark8
2011-02-08 21:46                               ` Georg Bauhaus
2011-02-08 22:35                                 ` Shark8
2011-02-10  2:18                             ` Randy Brukardt
2011-02-08 15:36               ` Hyman Rosen
2011-02-08 16:44                 ` Adam Beneschan
2011-02-08 17:13                   ` Hyman Rosen
2011-02-08 18:33                     ` Georg Bauhaus
2011-02-08 18:39                       ` Hyman Rosen
2011-02-03 17:43 ` John McCormick
2011-02-12  4:47 ` Edward Fish
2011-02-12  8:02   ` Niklas Holsti
2011-02-14  0:09   ` Hyman Rosen
2011-02-15  0:25     ` Randy Brukardt
2011-02-19  4:21       ` Edward Fish
2011-02-13  1:04 ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox