Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #78998 > unrolled thread

No, C is not a simple language

Started byJuha Nieminen <nospam@thanks.invalid>
First post2021-04-17 05:56 +0000
Last post2021-04-26 08:49 +0000
Articles 20 on this page of 143 — 32 participants

Back to article view | Back to comp.lang.c++


Contents

  No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-17 05:56 +0000
    Re: No, C is not a simple language Christian Gollwitzer <auriocus@gmx.de> - 2021-04-17 08:42 +0200
    Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-16 23:49 -0700
      Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-18 16:25 +0000
        Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-19 06:43 -0700
          Re: No, C is not a simple language Bo Persson <bo@bo-persson.se> - 2021-04-19 20:19 +0200
            Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-19 13:04 -0700
          Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-20 04:02 +0000
            Re: No, C is not a simple language Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-04-21 18:30 +0100
              Re: No, C is not a simple language scott@slp53.sl.home (Scott Lurndal) - 2021-04-21 18:33 +0000
                Re: No, C is not a simple language Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-04-21 21:14 +0100
                  Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-21 22:38 -0700
                Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-21 15:37 -0700
                Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-22 10:14 -0700
              Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-22 08:45 +0000
                Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-22 01:48 -0700
                Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-22 01:51 -0700
                  Re: No, C is not a simple language MrSpook_l0xjKyc@b3jtfv70fxckzmak.net - 2021-04-22 09:40 +0000
                    Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-22 12:38 -0700
                    Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-23 07:12 +0000
                      Re: No, C is not a simple language MrSpook_l0c6dv@66h4_0ccefudc0u8w.gov - 2021-04-23 09:14 +0000
                        Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 04:47 +0000
                          Re: No, C is not a simple language MrSpook_531q@dr4t0dkj168m4ml.tv - 2021-04-26 08:13 +0000
                            Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-26 01:22 -0700
                              Re: No, C is not a simple language MrSpook_9p05k3C69@xr34.gov.uk - 2021-04-26 09:03 +0000
                                Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-26 02:17 -0700
                                  Re: No, C is not a simple language MrSpook_i4zl8mHy@0tr9r.eu - 2021-04-26 09:23 +0000
                                Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-26 02:22 -0700
                            Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 09:37 +0000
                              Re: No, C is not a simple language MrSpook_gbzt63zc@83jpfr9ry9f55a.tv - 2021-04-26 10:22 +0000
                                Re: No, C is not a simple language Bo Persson <bo@bo-persson.se> - 2021-04-26 13:05 +0200
                                Re: No, C is not a simple language David Brown <david.brown@hesbynett.no> - 2021-04-26 13:10 +0200
                            Re: No, C is not a simple language Paavo Helde <myfirstname@osa.pri.ee> - 2021-04-26 14:38 +0300
                              Re: No, C is not a simple language MrSpook_mD_r@g72w8ixztm106rprqnby.tv - 2021-04-26 13:49 +0000
                Re: No, C is not a simple language MrSpook_lxrj1vfhmw@qdgb.org - 2021-04-22 09:37 +0000
                  Re: No, C is not a simple language Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-22 11:32 +0100
                    Re: No, C is not a simple language MrSpook_f0mj9r@d6g.gov.uk - 2021-04-22 10:38 +0000
                      Re: No, C is not a simple language Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-22 12:35 +0100
                Re: No, C is not a simple language Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-04-22 13:35 +0100
                  Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-23 07:20 +0000
                    Re: No, C is not a simple language Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-04-23 11:01 +0100
                      Re: No, C is not a simple language Paavo Helde <myfirstname@osa.pri.ee> - 2021-04-23 15:44 +0300
                        Re: No, C is not a simple language Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-04-23 17:52 +0100
                          Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 04:55 +0000
                            Re: No, C is not a simple language Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-04-26 22:16 +0100
                Re: No, C is not a simple language Manfred <noname@add.invalid> - 2021-04-22 16:30 +0200
                  Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-23 07:32 +0000
                    Re: No, C is not a simple language Manfred <noname@add.invalid> - 2021-04-23 20:35 +0200
                      Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 05:01 +0000
          Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-20 04:56 +0000
            Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-20 05:22 -0700
    Re: No, C is not a simple language MrSpook_wb@g9b2a_ex9aicgvs04.net - 2021-04-17 10:27 +0000
      Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-18 16:30 +0000
        Re: No, C is not a simple language MrSpook_wyzaq1485z@solbi8e3oaumg9.gov.uk - 2021-04-19 07:42 +0000
    Re: No, C is not a simple language jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-17 17:43 +0200
      Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-18 16:39 +0000
        Re: No, C is not a simple language jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-18 20:48 +0200
    Re: No, C is not a simple language Manfred <noname@add.invalid> - 2021-04-17 19:12 +0200
      Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-18 16:46 +0000
        Re: No, C is not a simple language Manfred <noname@add.invalid> - 2021-04-18 20:30 +0200
          Re: No, C is not a simple language Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-04-18 12:46 -0700
            Re: No, C is not a simple language Manfred <noname@add.invalid> - 2021-04-18 22:53 +0200
          Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-19 07:18 +0000
            Re: No, C is not a simple language Manfred <noname@add.invalid> - 2021-04-19 17:15 +0200
              Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-20 04:05 +0000
                Re: No, C is not a simple language Manfred <noname@add.invalid> - 2021-04-20 18:27 +0200
                  Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-20 16:41 +0000
                    Re: No, C is not a simple language jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-20 19:44 +0200
                      Re: No, C is not a simple language Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-20 18:30 +0000
                        Re: No, C is not a simple language jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-20 20:47 +0200
                          Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-20 13:29 -0700
                          Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-21 04:37 +0000
                            Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-20 22:02 -0700
                              Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-20 22:35 -0700
                            Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-21 15:26 -0700
                              Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-21 22:06 -0700
                                Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-22 08:52 +0000
                                  Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-22 09:41 -0700
                                    Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-23 07:34 +0000
                                      Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-23 04:58 -0700
                                        Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 05:04 +0000
                                        Re: No, C is not a simple language Paavo Helde <myfirstname@osa.pri.ee> - 2021-04-26 09:41 +0300
                                        Re: No, C is not a simple language James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-04-26 10:25 -0400
                                          Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-26 12:07 -0700
                                            Re: No, C is not a simple language Christian Gollwitzer <auriocus@gmx.de> - 2021-04-28 08:03 +0200
                                Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-22 09:26 -0700
                      Re: No, C is not a simple language Richard Damon <Richard@Damon-Family.org> - 2021-04-20 14:46 -0400
                        Re: No, C is not a simple language Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-20 20:18 +0000
                      Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-20 13:19 -0700
                        Re: No, C is not a simple language Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-20 20:29 +0000
                          Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-20 13:39 -0700
                            Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-20 14:29 -0700
                      Re: No, C is not a simple language Ian Collins <ian-news@hotmail.com> - 2021-04-21 08:56 +1200
                      Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-20 14:07 -0700
                        Re: No, C is not a simple language jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-23 12:10 +0200
                          Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-23 04:10 -0700
                            Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-28 00:32 -0700
                              Re: No, C is not a simple language wij <wyniijj@gmail.com> - 2021-04-28 11:04 -0700
                          Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 12:37 -0700
                            Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 12:38 -0700
                            Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 12:43 -0700
                              Re: No, C is not a simple language jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-23 22:38 +0200
                                Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 13:44 -0700
                                Re: No, C is not a simple language Ian Collins <ian-news@hotmail.com> - 2021-04-24 10:56 +1200
                                  Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 16:09 -0700
                              Re: No, C is not a simple language Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-24 03:51 +0000
                      Re: No, C is not a simple language Robert Latest <boblatest@yahoo.com> - 2021-04-26 09:24 +0000
                      Re: No, C is not a simple language Robert Latest <boblatest@yahoo.com> - 2021-04-26 09:27 +0000
                    Re: No, C is not a simple language "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2021-04-20 19:53 +0200
                    Re: No, C is not a simple language Robert Latest <boblatest@yahoo.com> - 2021-04-26 09:02 +0000
                      Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 09:43 +0000
                        Re: No, C is not a simple language Robert Latest <boblatest@yahoo.com> - 2021-04-26 10:35 +0000
                          Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 13:08 +0000
                            Re: No, C is not a simple language Richard Damon <Richard@Damon-Family.org> - 2021-04-26 09:30 -0400
                            Re: No, C is not a simple language Robert Latest <boblatest@yahoo.com> - 2021-04-26 14:15 +0000
                              Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-27 04:37 +0000
                                Re: No, C is not a simple language Robert Latest <boblatest@yahoo.com> - 2021-04-27 07:22 +0000
      Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-19 21:42 -0700
        Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-22 00:26 -0700
      Re: No, C is not a simple language "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-28 00:02 -0700
    Re: No, C is not a simple language Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-17 21:36 +0200
      Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-18 16:49 +0000
        Re: No, C is not a simple language Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-18 23:31 +0200
        Re: No, C is not a simple language Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-19 01:36 +0100
          Re: No, C is not a simple language Juha Nieminen <nospam@thanks.invalid> - 2021-04-19 07:19 +0000
            Re: No, C is not a simple language Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-19 11:36 +0100
            Re: No, C is not a simple language Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-19 16:54 +0200
    Re: No, C is not a simple language Paavo Helde <myfirstname@osa.pri.ee> - 2021-04-18 00:48 +0300
    Re: No, C is not a simple language (PLO) olcott <NoOne@NoWhere.com> - 2021-04-18 16:04 -0500
      Re: No, C is not a simple language (PLO) Juha Nieminen <nospam@thanks.invalid> - 2021-04-19 07:22 +0000
        Re: No, C is not a simple language (PLO) olcott <NoOne@NoWhere.com> - 2021-04-19 09:50 -0500
          Re: No, C is not a simple language (PLO) jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-19 19:05 +0200
            Re: No, C is not a simple language (PLO) olcott <NoOne@NoWhere.com> - 2021-04-19 12:23 -0500
            Re: No, C is not a simple language (PLO) scott@slp53.sl.home (Scott Lurndal) - 2021-04-19 18:02 +0000
            Re: No, C is not a simple language (PLO) jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-19 21:03 +0200
              Re: No, C is not a simple language (PLO) olcott <NoOne@NoWhere.com> - 2021-04-19 15:14 -0500
            Re: No, C is not a simple language (PLO) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-19 17:16 -0700
              Re: No, C is not a simple language (PLO) jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-20 07:32 +0200
                Re: No, C is not a simple language (PLO) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-19 23:47 -0700
            Re: No, C is not a simple language (PLO) Juha Nieminen <nospam@thanks.invalid> - 2021-04-20 10:29 +0000
              Re: No, C is not a simple language (PLO) jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-20 14:14 +0200
                Re: No, C is not a simple language (PLO) Juha Nieminen <nospam@thanks.invalid> - 2021-04-20 16:44 +0000
    Re: No, C is not a simple language Robert Latest <boblatest@yahoo.com> - 2021-04-26 08:49 +0000

Page 7 of 8 — ← Prev page 1 2 3 4 5 6 [7] 8  Next page →


#79013

FromBonita Montero <Bonita.Montero@gmail.com>
Date2021-04-17 21:36 +0200
Message-ID<s5fdbt$4hu$1@dont-email.me>
In reply to#78998
> I am of the strong opinion that no, C is not a "simple" language,
> and that C++ makes so many things so much simpler, easier and safer.

Of course C is a very simple language, i.e. the language itself is very
easy to understand. But it hard to develop in C because C lacks almost
every modern language facility. C++ as the language itself is hard to
understand, but if you've managed to understand it, it is by magnitudes
easier to develop with C++.

[toc] | [prev] | [next] | [standalone]


#79038

FromJuha Nieminen <nospam@thanks.invalid>
Date2021-04-18 16:49 +0000
Message-ID<s5hnu6$k19$2@gioia.aioe.org>
In reply to#79013
Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Of course C is a very simple language, i.e. the language itself is very
> easy to understand.

Where does that misconception come from?

Even many experienced C programmers will have difficulty in understanding eg.
the most complex function and array pointers, or even remember their syntax
(there's a reason why sites like cdecl.org exist.)

[toc] | [prev] | [next] | [standalone]


#79061

FromBonita Montero <Bonita.Montero@gmail.com>
Date2021-04-18 23:31 +0200
Message-ID<s5i8fd$q3n$1@dont-email.me>
In reply to#79038
> Where does that misconception come from?

That isn't a misconception.

[toc] | [prev] | [next] | [standalone]


#79063

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2021-04-19 01:36 +0100
Message-ID<87czur2jq5.fsf@bsb.me.uk>
In reply to#79038
Juha Nieminen <nospam@thanks.invalid> writes:

> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>> Of course C is a very simple language, i.e. the language itself is very
>> easy to understand.
>
> Where does that misconception come from?
>
> Even many experienced C programmers will have difficulty in understanding eg.
> the most complex function and array pointers, or even remember their syntax
> (there's a reason why sites like cdecl.org exist.)

C++ includes almost all of those.  And it throws a few more bits and
pieces into to mix (&, &&, pointer-to-member and so on).

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#79073

FromJuha Nieminen <nospam@thanks.invalid>
Date2021-04-19 07:19 +0000
Message-ID<s5jaul$1gq6$2@gioia.aioe.org>
In reply to#79063
Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> Juha Nieminen <nospam@thanks.invalid> writes:
> 
>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>> Of course C is a very simple language, i.e. the language itself is very
>>> easy to understand.
>>
>> Where does that misconception come from?
>>
>> Even many experienced C programmers will have difficulty in understanding eg.
>> the most complex function and array pointers, or even remember their syntax
>> (there's a reason why sites like cdecl.org exist.)
> 
> C++ includes almost all of those.  And it throws a few more bits and
> pieces into to mix (&, &&, pointer-to-member and so on).

I was not commenting on the complexity of C++. I was commenting on the
claim that C is "very easy to understand".

No, it's not. Not in all cases, even when we aren't dealing with deliberately
obfuscated code.

[toc] | [prev] | [next] | [standalone]


#79078

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2021-04-19 11:36 +0100
Message-ID<878s5e1ryx.fsf@bsb.me.uk>
In reply to#79073
Juha Nieminen <nospam@thanks.invalid> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
>> Juha Nieminen <nospam@thanks.invalid> writes:
>> 
>>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>>> Of course C is a very simple language, i.e. the language itself is very
>>>> easy to understand.
>>>
>>> Where does that misconception come from?
>>>
>>> Even many experienced C programmers will have difficulty in understanding eg.
>>> the most complex function and array pointers, or even remember their syntax
>>> (there's a reason why sites like cdecl.org exist.)
>> 
>> C++ includes almost all of those.  And it throws a few more bits and
>> pieces into to mix (&, &&, pointer-to-member and so on).
>
> I was not commenting on the complexity of C++. I was commenting on the
> claim that C is "very easy to understand".

Ah, sorry.  It would have been a bit clearer (since the discussion was
comparative) to say that both C and C++ have complex declaration syntax.

I get that you were countering the misconception that C is "very easy to
understand".  Maybe you simply took it for granted that C++ wasn't very
easy to understand and it didn't need to mentioned.

> No, it's not. Not in all cases, even when we aren't dealing with deliberately
> obfuscated code.

The usual advice, in both languages, is not to use the available syntax.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#79083

FromBonita Montero <Bonita.Montero@gmail.com>
Date2021-04-19 16:54 +0200
Message-ID<s5k5iv$ij2$1@dont-email.me>
In reply to#79073
> I was not commenting on the complexity of C++. I was commenting on the
> claim that C is "very easy to understand".
> No, it's not. Not in all cases, even when we aren't dealing with deliberately
> obfuscated code.

What I said wasn't related to actual code. Code could be
hard to understand also in even simpler languages like
Java. But the rules of the language are almost completely
easy to understand.

[toc] | [prev] | [next] | [standalone]


#79018

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2021-04-18 00:48 +0300
Message-ID<s5fl2h$lfb$1@dont-email.me>
In reply to#78998
17.04.2021 08:56 Juha Nieminen kirjutas:
> Many C fans keep insisting how C is so much better than C++ because
> C is such a simple, straightforward and beautiful language, so

This claim might be true, but this has no relevance to whether C should 
be used for a given task. For any given task one should choose the best 
fitting tool, not the simplest one.

For example, the simplest reliable tool for ensuring a horizontal level 
is a water-filled hose. OTOH, the easiest one to use is generally a 
cross line laser, built on technologies whose very existence is still 
not believed by some people. Nothing simple there.

However, in some circumstances, like with limited access and no clear 
line of sight, a water-filled hose might still yield a better result 
than any high-tech alternative (e.g. GPS).

So, for each usage there is a best tool. Sometimes the tool is itself 
simple, sometimes it's not. Sometimes there is no good tool and one 
needs to invent a new one (inventing TeX for typesetting comes to mind).

[toc] | [prev] | [next] | [standalone]


#79060 — Re: No, C is not a simple language (PLO)

Fromolcott <NoOne@NoWhere.com>
Date2021-04-18 16:04 -0500
SubjectRe: No, C is not a simple language (PLO)
Message-ID<k9GdncMPa6BNA-H9nZ2dnUU7-IfNnZ2d@giganews.com>
In reply to#78998
On 4/17/2021 12:56 AM, Juha Nieminen wrote:
> I know that this is probably going to piss off avid C programmers,
> but I don't really care all that much.
> 
> Many C fans keep insisting how C is so much better than C++ because
> C++ is so utterly complicated, with a standard that reads like a
> phonebook and a standard library so vast that nobody in their sane
> mind could ever even hope to remember all of it, and how C++ is
> becoming more and more complicated with every standard, and how
> C is such a simple, straightforward and beautiful language, so
> immensely better than C++.
> 
> I myself happen to know both languages quite well, and in fact I
> program in both languages as my profession, and I would say that
> I am very knowledgeable and proficient in both languages and have
> no trouble in developing in either one. I am of the strong opinion
> that no, C is not a "simple" language, and that C++ makes so many
> things so much simpler, easier and safer.
> 
> I was reminded of this in a quite concrete manner recently when I was
> trying to help a beginner programmer who had decided to try his hands
> on C, and wanted to create a simple text editor, which would read a
> text file, allow the user to edit the text in several ways, and to
> save the file.
> 
> It quite quickly turned very frustrating for *both* of us that dynamic
> string manipulation in C is so damn complicated, especially for a
> complete beginner who has never programmed in C, and has only very
> little experience even with other programming languages (he had some
> very small experience with Python.)
> 
> I tried approaching the problem by explaining that for a project of
> this nature and size, it would be much more better to create a separate
> (and reusable) "string" module, ie. a struct that represents a string
> (which has a char* and a length member variable), and a bunch of functions
> that operate on objects of that struct type, clearly and logically
> named. (In other words, I was trying to make him essentially replicate
> a subset of std::string in C.) This would make it much easier to do
> things like appending strings to other strings, inserting characters
> and strings in the middle of other strings (having them automatically
> grow dynamically), and so on.
> 
> Even then, it was just frustration after frustration, trying to explain
> and make him understand why in C you need to always explicitly call an
> initializer function (ie. "constructor") for every single new string
> object (and any struct that may have such a string object as a member
> variable, and any struct that may have those types of structs as
> members, all the way down), and especially how you have to make sure
> to call the destruction function for every such object, or else there
> would be a leak.
> 
> It's surprisingly complicated and frustrating to try to explain to a
> complete beginner how and why he should follow very strict coding
> practices when it comes to initializing and destructing every object
> and, especially, why he should be very careful about assigning string
> objects to each other directly. In the middle of this mountain of new
> complicated information, try to explain to a complete beginner the
> subtleties of doing this:
> 
>      String str1 = String_with_cstr("hello");
>      String str2 = str1;
> 
> While not wrong per se, and it actually does have its uses, it's very
> prone to errors because now str1 and str2 are pointing to the same
> string data, so only one of them must be destroyed and the other must
> not be used after that (unless it's initialized again).
> 
> Also, trying to inculcate how wrong this is, and how important it is
> to avoid it:
> 
>      String str1 = String_with_cstr("hello");
>      String str2 = String_with_cstr("there");
>      str1 = str2; // No!
> 
> He also asked why he couldn't do something like this:
> 
>      String str = "hello";
> 
> Now try to explain why that doesn't directly work (obviously causes
> a compiler error), and try to think whether you should explain that
> he *can* assign the string literal to the member char* of the struct
> (remember to also update the length parameter) but once again how fraught
> with peril that is, because now he will have to remember to *not* destruct
> *this* particular object, or else bad things will happen.
> 
> Then try to explain the concept of string capacity vs its length,
> which is useful in this kind of module because of efficiency reasons
> (and also because the string may become shorter, while retaining its
> capacity).
> 
> The worst thing, however, was trying to inculcate the importance of
> always properly initializing and destructing the objects at the proper
> places, and to avoid the pitfalls and mistakes that are so easy to make
> when handling such objects.
> 
> And those are just a couple of examples from many. I couldn't help but
> to constantly comment how much easier all this would be in C++, using
> std::string, where you don't have to worry about any of that. The
> project he was trying to make was almost *trivial* to do in C++, because
> of the readymade tools available in the standard library, and the
> ease and safety mechanisms provided by the language. Instead of writing
> thousands of lines of code to create his own string class, and then
> having to follow strict coding practices to avoid mistakes when creating
> dynamic arrays of such string objects, in C++ he could just create a
> std::vector<std::string> and be done with it. All the tools he needed
> for that project available easily and safely.
> 

I always took the same sort of approach. If you stick with the most 
important subset of C++ the standard template library and the ability to 
define self-contained objects, then C++ can greatly reduce the 
complexity of programming tasks.

Because of the tediousness of memory allocation errors I only used fixed 
length arrays in C, and I only use std::vector in C++. In several 
decades as a professional programmer I have never allocated memory in C 
or C++.

-- 
Copyright 2021 Pete Olcott

"Great spirits have always encountered violent opposition from mediocre 
minds." Einstein

[toc] | [prev] | [next] | [standalone]


#79074 — Re: No, C is not a simple language (PLO)

FromJuha Nieminen <nospam@thanks.invalid>
Date2021-04-19 07:22 +0000
SubjectRe: No, C is not a simple language (PLO)
Message-ID<s5jb3u$1gq6$3@gioia.aioe.org>
In reply to#79060
olcott <NoOne@nowhere.com> wrote:
> Because of the tediousness of memory allocation errors I only used fixed 
> length arrays in C, and I only use std::vector in C++. In several 
> decades as a professional programmer I have never allocated memory in C 
> or C++.

That's not always something you can avoid. Sometimes you need to, for example,
read an entire file into RAM. You can't just go and use a fixed-length
array for that.

(Just reading an entire file into RAM and doing something basig to it is
simple enough in C. However, it starts becoming complicated once you need
to start modifying parts of it such that they will grow larger. Like
inserting things into lines of text.)

[toc] | [prev] | [next] | [standalone]


#79082 — Re: No, C is not a simple language (PLO)

Fromolcott <NoOne@NoWhere.com>
Date2021-04-19 09:50 -0500
SubjectRe: No, C is not a simple language (PLO)
Message-ID<z_-dna2oUY4iBeD9nZ2dnUU7-IOdnZ2d@giganews.com>
In reply to#79074
On 4/19/2021 2:22 AM, Juha Nieminen wrote:
> olcott <NoOne@nowhere.com> wrote:
>> Because of the tediousness of memory allocation errors I only used fixed
>> length arrays in C, and I only use std::vector in C++. In several
>> decades as a professional programmer I have never allocated memory in C
>> or C++.
> 
> That's not always something you can avoid. Sometimes you need to, for example,
> read an entire file into RAM. You can't just go and use a fixed-length
> array for that.
> 

I read it into a std::vector that has its capacity set to the file size.

> (Just reading an entire file into RAM and doing something basig to it is
> simple enough in C. However, it starts becoming complicated once you need
> to start modifying parts of it such that they will grow larger. Like
> inserting things into lines of text.)
> 


-- 
Copyright 2021 Pete Olcott

"Great spirits have always encountered violent opposition from mediocre 
minds." Einstein

[toc] | [prev] | [next] | [standalone]


#79090 — Re: No, C is not a simple language (PLO)

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2021-04-19 19:05 +0200
SubjectRe: No, C is not a simple language (PLO)
Message-ID<s5kd8q$lul$1@dont-email.me>
In reply to#79082
Le 19/04/2021 à 16:50, olcott a écrit :
> I read it into a std::vector that has its capacity set to the file size.

char *FileToRam(FILE *input)
{
	fseek(f,0,SEEK_END);
	long size = ftell(f);
	fseek(f,0,SEEK_SET);
	char *result = malloc(1+size));
	if (result) {
		fread(result,1,size,f);
		result[size]=0;
	}
	return result;
}

No error checking, it is not very difficult to add it.

Another interface:

char *FileToRam(char *filename)
{
	FILE *f = fopen(filename,"rb");
	
	if (!f) return NULL;
	fseek(f,0,SEEK_END);
	long size = ftell(f);
	fseek(f,0,SEEK_SET);
	char *result = malloc(1+size));
	if (result) {
		fread(result,1,size,f);
		result[size]=0;
	}
	return result;
}

Is C unreadable? Too complicated? I guess not!

[toc] | [prev] | [next] | [standalone]


#79091 — Re: No, C is not a simple language (PLO)

Fromolcott <NoOne@NoWhere.com>
Date2021-04-19 12:23 -0500
SubjectRe: No, C is not a simple language (PLO)
Message-ID<ZYOdnan5Zdk0IeD9nZ2dnUU7-I3NnZ2d@giganews.com>
In reply to#79090
On 4/19/2021 12:05 PM, jacobnavia wrote:
> Le 19/04/2021 à 16:50, olcott a écrit :
>> I read it into a std::vector that has its capacity set to the file size.
> 
> char *FileToRam(FILE *input)
> {
>      fseek(f,0,SEEK_END);
>      long size = ftell(f);
>      fseek(f,0,SEEK_SET);
>      char *result = malloc(1+size));
>      if (result) {
>          fread(result,1,size,f);
>          result[size]=0;
>      }
>      return result;
> }
> 
> No error checking, it is not very difficult to add it.
> 
> Another interface:
> 
> char *FileToRam(char *filename)
> {
>      FILE *f = fopen(filename,"rb");
> 
>      if (!f) return NULL;
>      fseek(f,0,SEEK_END);
>      long size = ftell(f);
>      fseek(f,0,SEEK_SET);
>      char *result = malloc(1+size));
>      if (result) {
>          fread(result,1,size,f);
>          result[size]=0;
>      }
>      return result;
> }
> 
> Is C unreadable? Too complicated? I guess not!

If you read the input a std::vector that has had its size set to the 
file size then you can forget about the dynamic allocation of memory and 
there will never be any memory leaks.

This single fact makes C++ simpler than C. In the decades that I have 
been a C++ programmer I only use the standard template library and C++ 
classes and studiously ignore all of the rest of C++.

Self-contained classes eliminate scads of side-effects making them 
impossible, thus greatly reducing the time that it take for ongoing 
maintenance of a system, and greatly reducing overall system costs.

Linus Torvalds issues with C++ can be eliminated by coding standards 
that make the otherwise hidden execution time costs of OOP utterly 
visible. If we simply consider C++ as C with classes and a stanard 
template library (the way that I do) his objections go away.


-- 
Copyright 2021 Pete Olcott

"Great spirits have always encountered violent opposition from mediocre 
minds." Einstein

[toc] | [prev] | [next] | [standalone]


#79092 — Re: No, C is not a simple language (PLO)

Fromscott@slp53.sl.home (Scott Lurndal)
Date2021-04-19 18:02 +0000
SubjectRe: No, C is not a simple language (PLO)
Message-ID<GAjfI.14199$D16.8331@fx40.iad>
In reply to#79090
jacobnavia <jacob@jacob.remcomp.fr> writes:
>Le 19/04/2021 à 16:50, olcott a écrit :
>> I read it into a std::vector that has its capacity set to the file size.
>
>char *FileToRam(FILE *input)
>{
>	fseek(f,0,SEEK_END);
>	long size = ftell(f);
>	fseek(f,0,SEEK_SET);
>	char *result = malloc(1+size));
>	if (result) {
>		fread(result,1,size,f);
>		result[size]=0;
>	}
>	return result;
>}
>
>No error checking, it is not very difficult to add it.

mmap is even easier since you don't need to allocate memory.

[toc] | [prev] | [next] | [standalone]


#79096 — Re: No, C is not a simple language (PLO)

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2021-04-19 21:03 +0200
SubjectRe: No, C is not a simple language (PLO)
Message-ID<s5kk6a$b6c$1@dont-email.me>
In reply to#79090
Le 19/04/2021 à 19:05, jacobnavia a écrit :
> Le 19/04/2021 à 16:50, olcott a écrit :
>> I read it into a std::vector that has its capacity set to the file size.
> 
> char *FileToRam(FILE *input)
> {
>      fseek(f,0,SEEK_END);
>      long size = ftell(f);
>      fseek(f,0,SEEK_SET);
>      char *result = malloc(1+size));
>      if (result) {
>          fread(result,1,size,f);
>          result[size]=0;
>      }
>      return result;
> }
> 
> No error checking, it is not very difficult to add it.
> 
> Another interface:
> 
> char *FileToRam(char *filename)
> {
>      FILE *f = fopen(filename,"rb");
> 
>      if (!f) return NULL;
>      fseek(f,0,SEEK_END);
>      long size = ftell(f);
>      fseek(f,0,SEEK_SET);
>      char *result = malloc(1+size));
>      if (result) {
>          fread(result,1,size,f);
>          result[size]=0;
>      }
>      return result;
> }
> 
> Is C unreadable? Too complicated? I guess not!

Mmmmmm I am ashamed to acknowledge that I did not close the file in the 
second example. I saw it after posting. Sorry

[toc] | [prev] | [next] | [standalone]


#79098 — Re: No, C is not a simple language (PLO)

Fromolcott <NoOne@NoWhere.com>
Date2021-04-19 15:14 -0500
SubjectRe: No, C is not a simple language (PLO)
Message-ID<XpmdnTU0Xb4FeeD9nZ2dnUU7-VnNnZ2d@giganews.com>
In reply to#79096
On 4/19/2021 2:03 PM, jacobnavia wrote:
> Le 19/04/2021 à 19:05, jacobnavia a écrit :
>> Le 19/04/2021 à 16:50, olcott a écrit :
>>> I read it into a std::vector that has its capacity set to the file size.
>>
>> char *FileToRam(FILE *input)
>> {
>>      fseek(f,0,SEEK_END);
>>      long size = ftell(f);
>>      fseek(f,0,SEEK_SET);
>>      char *result = malloc(1+size));
>>      if (result) {
>>          fread(result,1,size,f);
>>          result[size]=0;
>>      }
>>      return result;
>> }
>>
>> No error checking, it is not very difficult to add it.
>>
>> Another interface:
>>
>> char *FileToRam(char *filename)
>> {
>>      FILE *f = fopen(filename,"rb");
>>
>>      if (!f) return NULL;
>>      fseek(f,0,SEEK_END);
>>      long size = ftell(f);
>>      fseek(f,0,SEEK_SET);
>>      char *result = malloc(1+size));
>>      if (result) {
>>          fread(result,1,size,f);
>>          result[size]=0;
>>      }
>>      return result;
>> }
>>
>> Is C unreadable? Too complicated? I guess not!
> 
> Mmmmmm I am ashamed to acknowledge that I did not close the file in the 
> second example. I saw it after posting. Sorry

In the above example using a C++ std::vector that is resized to the size 
of the input file does make memory leaks utterly impossible.

Making memory leaks utterly impossible is a substantially more reliable 
paradigm than allowing possible memory leaks to exist.

It is possible to gain this one single benefit of C++ and totally ignore 
every other aspect of C++ by simply writing programs using the same C 
style, yet compile them as c++ programs with a ".cpp" suffix.

Many C programmers do not switch to c++ because of the learning curve.

By focusing on a tiny subset of c++ (a) the standard template library 
and (b) encapsulating data and functions together in classes, 90% of the 
benefit of c++ can be achieved with a tiny little learning curve cost.

I started programming in C when K&R was the only standard.

-- 
Copyright 2021 Pete Olcott

"Great spirits have always encountered violent opposition from mediocre 
minds." Einstein

[toc] | [prev] | [next] | [standalone]


#79100 — Re: No, C is not a simple language (PLO)

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2021-04-19 17:16 -0700
SubjectRe: No, C is not a simple language (PLO)
Message-ID<s5l6h5$11ag$1@gioia.aioe.org>
In reply to#79090
On 4/19/2021 10:05 AM, jacobnavia wrote:
> Le 19/04/2021 à 16:50, olcott a écrit :
>> I read it into a std::vector that has its capacity set to the file size.
> 
> char *FileToRam(FILE *input)
> {
>      fseek(f,0,SEEK_END);
>      long size = ftell(f);
>      fseek(f,0,SEEK_SET);
>      char *result = malloc(1+size));
>      if (result) {
>          fread(result,1,size,f);
>          result[size]=0;

Why are you zero terminating this? Is the files contents meant to be 
used as a C string?


>      }
>      return result;
> }
[...]

[toc] | [prev] | [next] | [standalone]


#79106 — Re: No, C is not a simple language (PLO)

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2021-04-20 07:32 +0200
SubjectRe: No, C is not a simple language (PLO)
Message-ID<s5lp19$19b$1@dont-email.me>
In reply to#79100
Le 20/04/2021 à 02:16, Chris M. Thomasson a écrit :
> On 4/19/2021 10:05 AM, jacobnavia wrote:
>> Le 19/04/2021 à 16:50, olcott a écrit :
>>> I read it into a std::vector that has its capacity set to the file size.
>>
>> char *FileToRam(FILE *input)
>> {
>>      fseek(f,0,SEEK_END);
>>      long size = ftell(f);
>>      fseek(f,0,SEEK_SET);
>>      char *result = malloc(1+size));
>>      if (result) {
>>          fread(result,1,size,f);
>>          result[size]=0;
> 
> Why are you zero terminating this? Is the files contents meant to be 
> used as a C string?
> 

Maybe. This utility doesn't NEED to know the usage, and zero terminating 
it allows to use it as a string if the client code needs to. The cost is 
completely negligible (writing zero to a byte).

> 
>>      }
>>      return result;
>> }
> [...]

[toc] | [prev] | [next] | [standalone]


#79107 — Re: No, C is not a simple language (PLO)

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2021-04-19 23:47 -0700
SubjectRe: No, C is not a simple language (PLO)
Message-ID<s5ltdv$873$1@gioia.aioe.org>
In reply to#79106
On 4/19/2021 10:32 PM, jacobnavia wrote:
> Le 20/04/2021 à 02:16, Chris M. Thomasson a écrit :
>> On 4/19/2021 10:05 AM, jacobnavia wrote:
>>> Le 19/04/2021 à 16:50, olcott a écrit :
>>>> I read it into a std::vector that has its capacity set to the file 
>>>> size.
>>>
>>> char *FileToRam(FILE *input)
>>> {
>>>      fseek(f,0,SEEK_END);
>>>      long size = ftell(f);
>>>      fseek(f,0,SEEK_SET);
>>>      char *result = malloc(1+size));
>>>      if (result) {
>>>          fread(result,1,size,f);
>>>          result[size]=0;
>>
>> Why are you zero terminating this? Is the files contents meant to be 
>> used as a C string?
>>
> 
> Maybe. This utility doesn't NEED to know the usage, and zero terminating 
> it allows to use it as a string if the client code needs to.

Okay. I see.


> The cost is 
> completely negligible (writing zero to a byte).

I can think of a pretty hardcore nitpick. Think of a space constrained 
client system that has very strict structured memory usage. Say it 
forces your FileToRam function to use its own special malloc/free where 
everything is aligned and padded to cache lines. So, that 1 byte of over 
allocation can make malloc allocate a whole extra cache line! ;^)

The user wants to load a file that is 32 cache lines in size. Therefore, 
it wants to allocate exactly 32 cache lines of memory, no more, no less. 
However, you add that extra byte and force malloc to actually allocate 
33 cache lines instead.

Sorry for the ultra hardcore nitpick. ;^o


> 
>>
>>>      }
>>>      return result;
>>> }
>> [...]
> 

[toc] | [prev] | [next] | [standalone]


#79108 — Re: No, C is not a simple language (PLO)

FromJuha Nieminen <nospam@thanks.invalid>
Date2021-04-20 10:29 +0000
SubjectRe: No, C is not a simple language (PLO)
Message-ID<s5maef$d6b$1@gioia.aioe.org>
In reply to#79090
jacobnavia <jacob@jacob.remcomp.fr> wrote:
> char *FileToRam(FILE *input)

By the way, it's always a good idea to use clear names that convey what
the function is doing, especially when we are talking about a C function
that does something like this. Optimally code would be self-documenting.

I think a declaration like this better conveys what the function does,
and that the calling code is responsible for freeing the return value:

  char* allocByteArrayWithContentsOfFile(FILE* input);

Or, if you prefer:

  char* alloc_byte_array_with_contents_of_file(FILE* input);

The "alloc" at the beginning better conveys that this is, indeed, an
allocation function and that the returned pointer points to something that
needs to be freed. (In C++ one usually doesn't need to convey this because,
usually, you would use as return value an object that itself manages the
allocated memory.)

It's also quite customary in C for such functions to return a success/error
code, instead of the allocated array. While not universal, you see this
quite a lot in C. So, perhaps, it could be like:

  int alloc_byte_array_with_contents_of_file(FILE* input, char** dest);

Different return values can then be used to convey different types of error
(such as an error reading or seeking the file, or allocating the array).

[toc] | [prev] | [next] | [standalone]


Page 7 of 8 — ← Prev page 1 2 3 4 5 6 [7] 8  Next page →

Back to top | Article view | comp.lang.c++


csiph-web