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


Groups > comp.lang.c++ > #79266

Re: No, C is not a simple language

From Paavo Helde <myfirstname@osa.pri.ee>
Newsgroups comp.lang.c++
Subject Re: No, C is not a simple language
Date 2021-04-26 09:41 +0300
Organization A noiseless patient Spider
Message-ID <s65nb5$fd5$1@dont-email.me> (permalink)
References (11 earlier) <c105a5d3-4a8d-4fc9-a1d2-eab2374dce16n@googlegroups.com> <s5rdfo$612$1@gioia.aioe.org> <a96c61d4-d2dc-44cd-b563-61cdea504f83n@googlegroups.com> <s5tt9l$q2b$2@gioia.aioe.org> <c3a5bc5f-1f10-443a-b508-b0a71f42af26n@googlegroups.com>

Show all headers | View raw


23.04.2021 14:58 wij kirjutas:
> 
> std::string provides "helper functions" to manipulate "C-string"
> (precisely speaking, this was an error of 'pure' C++, we are now actually
> talking about an erroneous feature of C++), does not mean C is ugly.

What? Making a C++ feature interoperable with C is an error?

One might argue that std::string class is too large and attempts to do 
too many things, and there might be a bit truth in it. That's why we now 
have other classes like std::string_view. On the other hand, all this 
large interface is sometimes needed, I think the only member function I 
have never used is std::string::at().

> 
> Helper functions(or macro/template) come with cost (user usually do not care,
> but note that it can accumulate) and can not cover all cases. 

I have no idea what you mean here. Arguably the whole C string 
manipulation is done by helper functions like strcat().

> You cannot use
> memcpy/memmove in 'pure' C++.

What? Technically memcpy() is the most correct way to do type punning in 
C++, for example. How come the most correct way to do something cannot 
be used?

I guess you wanted to say that memcpy() may not be used with non-trivial 
C++ objects. That's true, but what is the point? In C you may not call 
free() with an address of a local variable, this does not make free() 
unusable.

And what's the relation to the string processing? The std::string move 
operator will easily beat any memcpy() or memmove() of string contents, 
with the extra bonus that it is much less error prone.

> 
> As to the memory allocation issue, in extreme cases (real programs will encounter),
> e.g. many string objects, or one long string, one might even need to use zero-terminate
> c-string directly and RAII becomes a hinder.

Here I can not even guess what crossed your mind when writing these 
sentences. In case you are a not aware, all strings hold be std::string 
are already automatically zero-terminated nowadays.

If you want to really attack C++ over C you should express yourself more 
coherently. And choose some other topic, string processing is not an 
area where you can win, or even look credible.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web