comp.lang.ada
 help / color / mirror / Atom feed
From: "Elias Salomão Helou Neto" <eshneto@gmail.com>
Subject: Re: Fun with C
Date: Mon, 18 Apr 2011 12:47:56 -0700 (PDT)
Date: 2011-04-18T12:47:56-07:00	[thread overview]
Message-ID: <3650450b-d844-4999-86d6-ad7085458651@17g2000prr.googlegroups.com> (raw)
In-Reply-To: ffd37028-feb6-4c12-b024-d073df72fc28@a19g2000prj.googlegroups.com

On Apr 17, 5:18 pm, KK6GM <mjsi...@scriptoriumdesigns.com> wrote:
> On Apr 17, 12:35 pm, Elias Salomão Helou Neto <eshn...@gmail.com>
> wrote:
>
>
>
>
>
>
>
>
>
> > On Apr 17, 1:15 pm, KK6GM <mjsi...@scriptoriumdesigns.com> wrote:
>
> > > On Apr 16, 11:59 pm, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
> > > wrote:
>
> > > > On 4/17/11 8:26 AM, KK6GM wrote:
>
> > > > > Wow and wow.  I've been writing C all my adult life and I didn't
> > > > > realize this could or would happen.  I would have said that the
> > > > > unsigned would be promoted to signed.
>
> > > > > I'm going to include this example in my push to use Ada in our next
> > > > > project.
>
> > > > Be careful that there are no C savvy people around.
> > > > You are demonstrating a lack of understanding of C basics!
> > > > ("Stupid!")
> > > > That lack is not (in their view, and it's their view that counts)
> > > > a good start for asking for a different language.
>
> > > > Had you read section 2.7 of K&R (or A.6), you'd have expected
> > > > the result you got: arithmetic operators will convert their
> > > > arguments following the rules of the C language definition.
>
> > > Yes, I understand how the "stupid" argument works in the C community.
> > > I'm going to ask some other programmers tomorrow and see how many of
> > > them get this right.  I'm guessing our situation will be similar to
> > > the situation at the OP's workplace, where presumably competent
> > > programmers still got clobbered by this language-legal insanity.
>
> > Most programmers are competent in their views. Few really are and it
> > does not matter what is the actual language. For example, looks like
> > you feel you are competent in C, but are you?
>
> > "I would expect unsigned to int conversion" is just unacceptable!
> > Someone has written a line of code without knowing what it does. Is it
> > a language problem? Not that C is spectacular, but blaming the
> > language here is not fair. Minimally competent C programmers do know
> > about such conversions. If you don't you suck as a C programmer. If
> > you suck as a C programmer, please do not try to advocate any other
> > language over it, this _is_ stupid!
> > - Show quoted text -
>
> So, the spankings begin. :)
>
> What is a competent programmer?  One who has made a good living using
> the language for 30 years, with no complaints as to my competency?
> That's my only claim.  Perhaps the programmers in the OP's
> organization would make a similar claim.  I guess in some perfect
> world we wouldn't need any of the myriad of checking and verification
> tools and rules that people use to protect themselves from their
> chosen programming language.
>
> You are making a classic "CMM0" argument, where heroic programmers are
> necessary to acheive semi-acceptable results.  You criticize those who
> do not know some arcane language rule, when I think the real criticism
> shoult be for a language, any language, that blows up on -2048/128.
>
> C is a Steam Age language.  It served a purpose, but it is a sign of
> unseriousness and immaturity in our industry that it is still so
> widely used, that the terms "C" and "best practice" can ever be found
> together.
>
> I work at a company that uses a lot of very large and dangerous
> machines for manufacturing.  They would not for a moment stand for
> their machines to be as dangerous as C is.  Nor would their insurers
> nor the various government organizations to which they must account.
> It's not enough any more to say "Yes, C may silently rip the scalp off
> of your head, or chop off your arm, but only if you don't know all the
> rules and obey them without fail."  Are we to be forever stuck in the
> year 1900, programming language-wise?

Yes, at least while the huge codebase written in C remains. What is
dumbness, ignoring it or living with it? Go and use Ada for your
safety critical software, but there are uses for C too, if you don't
know.

Do you know what is dumbness? Trying to create "A Language to Rule
them All". Ada is Ada and C is C. I have never seen a real numeric
library in Ada, there are tons written in FORTRAN, C and C++. Now go
and advocate Ada for those folks too, you surely know more than all of
us about numeric programming don't you? Or why would we keep using a
year 1900 programming language? Go and advocate Ada for system
programming, of course there is no Ada OS in use today simply because
all system programmers are stupid and stubborn and prefer C or C++
over the much better Ada. Ada is for everything. Now, this is
dumbness.

Have you ever heard me saying Ada sucks? No, because saying it is
stupid. As it is also stupid to say that C sucks. Neither FORTRAN or
assembly sucks as well. Use each language where it should be used and
this is being smart. Maybe even Java has its proper place.

Anyone who says "C sucks", "Ada sucks", "FORTRAN sucks", "C++ sucks",
is being stupid. The way to go is to select the proper tool for the
job. Maybe "C sucks for safety-critical embedded systems" would be
better. And C will never suck only because its type promotion system.
While it is not intuitive it is pretty simple and easy to understand:
are you mixing unsigned and int and wish to obtain a signed integer?
Use a cast to int on the unsigned. This is really very difficult to
learn, isn't it?

>
> -2048/128 = 33554416 (or whatever your int size produces).  There's
> little more to say.

If this is your argument against C, there is nothing to say. I dislike
those rules too and when I was a beginner they used to surprise me as
well. But now I know what I am doing and I refuse to keep whining
against it. I am not such a sissy.



  reply	other threads:[~2011-04-18 19:47 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-16 17:02 Fun with C George P.
2011-04-16 20:04 ` Nasser M. Abbasi
2011-04-16 21:12   ` Ludovic Brenta
2011-04-16 21:42     ` jimmaureenrogers
2011-04-17  7:17     ` Georg Bauhaus
2011-04-17  8:29       ` Martin
2011-04-17 18:19       ` George P.
2011-04-17  8:40     ` Georg Bauhaus
2011-04-18  1:04     ` Peter C. Chapin
2011-04-18  2:14       ` George P.
2011-04-16 22:03   ` George P.
2011-04-17  6:26 ` KK6GM
2011-04-17  6:59   ` Georg Bauhaus
2011-04-17 16:15     ` KK6GM
2011-04-17 19:35       ` Elias Salomão Helou Neto
2011-04-17 20:18         ` KK6GM
2011-04-18 19:47           ` Elias Salomão Helou Neto [this message]
2011-04-18 22:11             ` Peter C. Chapin
2011-04-17 22:26         ` Georg Bauhaus
2011-04-18 19:12           ` Elias Salomão Helou Neto
2011-04-18 20:56             ` KK6GM
2011-04-18 21:01             ` Georg Bauhaus
2011-04-18 21:20               ` Nasser M. Abbasi
2011-04-19  2:43                 ` George P.
2011-04-19 18:05                   ` Vinzent Hoefler
2011-04-19 19:34                     ` George P.
2011-04-19 20:08                       ` Georg Bauhaus
2011-04-19  1:10               ` Elias Salomão Helou Neto
2011-04-19 14:28                 ` Georg Bauhaus
2011-04-19 17:40                   ` Jeffrey Carter
2011-04-21 14:52                   ` Elias Salomão Helou Neto
2011-04-21 18:58                     ` Georg Bauhaus
2011-04-21 19:27                       ` Hyman Rosen
2011-04-28  5:13                         ` David Thompson
2011-04-28 13:41                           ` Hyman Rosen
2011-05-05  8:39                             ` David Thompson
2011-04-25 11:06                 ` Paul Colin Gloster
2011-04-25 11:00                   ` Georg Bauhaus
2011-04-25 12:12                     ` Martin
2011-04-25 18:39                       ` Paul Colin Gloster
2011-05-08 23:41           ` wilso
2011-05-20 10:41             ` Yannick Duchêne (Hibou57)
2011-05-20 16:04               ` Yannick Duchêne (Hibou57)
2011-04-18  0:12         ` George P.
2011-04-18 19:24           ` Elias Salomão Helou Neto
2011-04-19  1:22             ` George P.
2011-04-19  2:06               ` Elias Salomão Helou Neto
2011-04-19  2:37                 ` Bill Findlay
2011-04-19  3:00                 ` George P.
2011-04-17 19:19 ` Elias Salomão Helou Neto
2011-04-17 23:26   ` Gautier write-only
2011-04-17 23:43     ` Nasser M. Abbasi
2011-04-18 19:16       ` Elias Salomão Helou Neto
2011-04-18 23:10         ` Randy Brukardt
2011-04-19  1:36           ` Elias Salomão Helou Neto
2011-04-20 23:14             ` Randy Brukardt
2011-04-21 16:19               ` Elias Salomão Helou Neto
2011-04-21 17:36                 ` Dmitry A. Kazakov
2011-04-21 17:43                   ` Hyman Rosen
2011-04-21 19:44                     ` Dmitry A. Kazakov
2011-04-22  6:16                   ` Elias Salomão Helou Neto
2011-04-22  9:21                     ` Dmitry A. Kazakov
2011-04-22 13:18                       ` Hyman Rosen
2011-04-22 15:17                         ` Dmitry A. Kazakov
2011-04-23  2:08                       ` Elias Salomão Helou Neto
2011-04-23  7:23                         ` Dmitry A. Kazakov
2011-04-23  9:42                           ` Georg Bauhaus
2011-04-23 10:23                             ` Dmitry A. Kazakov
2011-04-23 18:37                           ` Elias Salomão Helou Neto
2011-04-23 21:36                             ` Dmitry A. Kazakov
2011-04-24 11:27                               ` Peter C. Chapin
2011-04-24 13:53                                 ` Dmitry A. Kazakov
2011-04-24 19:07                                   ` Nasser M. Abbasi
2011-04-24 19:46                                     ` Dmitry A. Kazakov
2011-04-24 21:20                                       ` Nasser M. Abbasi
2011-04-24 22:33                                         ` Elias Salomão Helou Neto
2011-04-25  7:09                                         ` Dmitry A. Kazakov
2011-04-25 20:46                                           ` Maciej Sobczak
2011-04-25 21:19                                             ` George P.
2011-04-26  6:18                                             ` Dmitry A. Kazakov
2011-04-26  6:58                                               ` Nasser M. Abbasi
2011-04-26  8:39                                                 ` Dmitry A. Kazakov
2011-04-26 20:57                                               ` Maciej Sobczak
2011-04-27  8:00                                                 ` Dmitry A. Kazakov
2011-04-27  8:19                                                   ` Georg Bauhaus
2011-04-27  9:32                                                     ` Dmitry A. Kazakov
2011-04-28  7:02                                                   ` Maciej Sobczak
2011-04-28  7:41                                                     ` Dmitry A. Kazakov
2011-04-28 10:24                                                       ` Peter C. Chapin
2011-04-28 13:56                                                         ` Dmitry A. Kazakov
2011-05-03  1:19                                                           ` Nasser M. Abbasi
2011-05-03  6:05                                                             ` J-P. Rosen
2011-05-03  6:15                                                               ` Ludovic Brenta
2011-05-03  7:43                                                                 ` Dmitry A. Kazakov
2011-05-03 15:34                                                               ` Bill Findlay
2011-05-03  7:53                                                             ` Georg Bauhaus
2011-05-03  9:29                                                             ` Simon Wright
2011-04-24 22:23                                       ` Elias Salomão Helou Neto
2011-04-25  7:10                                         ` Dmitry A. Kazakov
2011-04-24 20:37                                 ` Georg Bauhaus
2011-04-23 15:23                         ` George P.
2011-04-23 17:28                           ` Nasser M. Abbasi
2011-04-23 17:52                             ` Dmitry A. Kazakov
2011-04-23 18:11                               ` Nasser M. Abbasi
2011-04-23 20:47                               ` George P.
2011-04-24 11:36                                 ` Peter C. Chapin
2011-04-25 11:43                                   ` Paul Colin Gloster
2011-04-23 16:56                         ` Nasser M. Abbasi
2011-04-23 18:45                           ` Elias Salomão Helou Neto
2011-04-22 12:15                     ` J-P. Rosen
2011-04-22 14:56                       ` Niklas Holsti
2011-04-21 23:29                 ` Randy Brukardt
2011-04-22  6:29                   ` Elias Salomão Helou Neto
2011-04-25 11:22                 ` Paul Colin Gloster
2011-04-18 19:13     ` Elias Salomão Helou Neto
2011-04-20  5:11   ` J-P. Rosen
2011-04-20 15:45     ` KK6GM
2011-04-20 19:04     ` Vinzent Hoefler
2011-04-20 21:09       ` Georg Bauhaus
2011-04-20 22:52         ` Vinzent Hoefler
2011-04-21 14:18     ` Elias Salomão Helou Neto
2011-04-21 16:22       ` Vinzent Hoefler
2011-04-21 19:25         ` John B. Matthews
2011-04-23 23:07 ` Gerd
replies disabled

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