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


Groups > comp.lang.c > #105901

Re: va_start without the first argument?

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: va_start without the first argument?
Date 2017-03-13 15:43 +1300
Message-ID <eimfa6Fhe2lU7@mid.individual.net> (permalink)
References (11 earlier) <oa49f0$79d$1@dont-email.me> <oa4csk$jd4$1@dont-email.me> <oa4f3e$r2v$1@dont-email.me> <7fda2e02-9a6a-411f-9d91-1ad9030ec778@googlegroups.com> <oa4nui$q3e$1@dont-email.me>

Show all headers | View raw


On 03/13/17 01:11 PM, jacobnavia wrote:

<snip>

> Here is the center of the problem. Is each operation necessary? Couldn't
> another algorithm speed up the processing? Are those convoluted class
> hierarchies really necessary? Couldn't we simplify a bit?
>
> I think many people have lost the motivation for doing minimal programs
> since machines have become so powerful. Who cares?
>
> We have enough RAM and CPU.

That my apply to desktop and server applications (why else would people 
use Java!), but it definitely isn't the case for embedded and kernel 
space developers.

> But there are hidden costs that everyone pays for doing bloated
> software, that is also unmaintainable because of its sheer size!

Size doesn't make code unmaintainable, poor software engineering does. 
I have to work in the Linux and Illumos kernels from time to time: Both 
are large and neither is unmaintainable.

> Simplifying is not a luxury, it is necessary. In this time when everyone
> is going in the wrong direction it would be better to stop and reflect
> if all that complexity is really necessary.

Indeed, simplicity is one of the cornerstones of agile development. 
Most over complex code I have had the dubious pleasure of maintaining 
got into a mess because successive developers added more functionality 
without taking the time to refactor the code.  Often they were unable to 
do this because the code lacked adequate tests so there was too much 
risk associated with changing it.

> For instance Thiago wanted a new syntax for lambdas recently. I objected
> that the new syntax complexifies C and doesn't really bring something
> imperatively new. You can do function pointer calls in C, and all
> computers I have used had a call instruction where the address of the
> call is in a register.

I think most here though likewise.  There is a much greater benefit from 
lambdas in C++ that there is in C.

<snip>

Here we go.. the hoary old chestnut FUD roaster is out...

> But then C++ adds some trillions of complexity into the mix. It is still
> a compiled language but there are already several problems:
>
> 1) Exception handling. A run time interpreter is generated, that will
> walk the stack frames executing destructors if there is an exception.
>
> Well, here the performance is not important since it is an exception, so
> that path is not taken very often.
>
> Or is it?
>
> If you start programming using that too often you will end up with a
> slow program.

So don't!

> 2)
> Another problem for C++ is the hidden constructors/destructors calls
> when building temporary objects, what sometimes could mean unnecessary
> heap usage. That has been reduced by the heroic efforts of the
> optimizing compilers, that everyone takes for granted. C++ has sometimes
> a good speed because a huge and complex machinery has been built, to
> deduce when the code could be optimized by proving that the action
> specified by the language is unnecessary.

Constructors and destructors are only there is someone has written them 
and they are only written if they have a job to do!

> 3) Code bloat.
> Another problem with C++ is the "inline" statement. This tends to bloat
> the generated code in a big way, saving the effort of constructing a
> stack frame and making a function call, but at the cost of swamping the
> code caches and slowing down the CPU to read more code from memory.

Well that's no different to C.  Most compilers probably use the same 
back end to perform inlining in C and C++.

> Templates add their contribution to code bloat also. Templates allow the
> easy generation of specialized functions but they replicate code also,
> making that approach resposible for a LOT of code duplication. Could
> they be replaced by simpler stuff like passing a code for the argument
> type and specifying as templates a small subset of the generated function?

That is often done.  Don't forget that templates are often used in C++ 
where macros would be used in C and the compiler can choose whether or 
not to inline a template function instantiation, but it can't choose not 
to inline a macro...

> Note that the code duplication makes it possible to write a single piece
> of code for very different types, what simplifies maintenance.
>
> Everything in engineering is a compromise.

Indeed.

-- 
Ian

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


Thread

va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-10 11:57 -0800
  Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-10 12:04 -0800
  Re: va_start without the first argument? Keith Thompson <kst-u@mib.org> - 2017-03-10 12:32 -0800
    Re: va_start without the first argument? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-03-10 15:51 -0500
    Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-10 14:36 -0800
      Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-10 14:53 -0800
        Re: va_start without the first argument? Robert Wessel <robertwessel2@yahoo.com> - 2017-03-10 17:14 -0600
          Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-10 15:37 -0800
            Re: va_start without the first argument? Robert Wessel <robertwessel2@yahoo.com> - 2017-03-10 23:12 -0600
              Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 10:29 -0700
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 11:31 -0700
                Re: va_start without the first argument? scott@slp53.sl.home (Scott Lurndal) - 2017-03-13 18:40 +0000
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 12:31 -0700
            Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-11 19:53 +0100
              Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-11 19:05 +0000
                Re: va_start without the first argument? Keith Thompson <kst-u@mib.org> - 2017-03-11 11:56 -0800
              Re: va_start without the first argument? antispam@math.uni.wroc.pl - 2017-03-12 05:41 +0000
              Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-12 13:52 +0100
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-12 14:40 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-12 18:13 +0100
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-12 18:04 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-12 21:04 +0100
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-12 21:02 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-12 22:40 +0100
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-12 15:51 -0700
                Re: va_start without the first argument? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-12 16:52 -0700
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-13 00:56 +0100
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-13 09:17 -0700
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-13 17:54 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-13 22:12 +0100
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-13 22:48 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-14 13:46 +0100
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-14 13:37 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-14 15:24 +0100
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-14 08:25 -0700
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-14 17:02 +0100
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-14 09:45 -0700
                Re: va_start without the first argument? Keith Thompson <kst-u@mib.org> - 2017-03-14 09:15 -0700
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-14 10:02 -0700
                Re: va_start without the first argument? jt@toerring.de (Jens Thoms Toerring) - 2017-03-14 20:32 +0000
                Re: va_start without the first argument? raltbos@xs4all.nl (Richard Bos) - 2017-03-14 07:44 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-14 13:38 +0100
                Re: va_start without the first argument? Keith Thompson <kst-u@mib.org> - 2017-03-14 08:57 -0700
                Re: va_start without the first argument? Keith Thompson <kst-u@mib.org> - 2017-03-13 11:21 -0700
                Re: va_start without the first argument? scott@slp53.sl.home (Scott Lurndal) - 2017-03-13 18:33 +0000
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-13 22:08 +0100
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-13 15:23 -0700
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-14 13:58 +0100
                Re: va_start without the first argument? Keith Thompson <kst-u@mib.org> - 2017-03-14 09:18 -0700
                Re: va_start without the first argument? scott@slp53.sl.home (Scott Lurndal) - 2017-03-14 16:52 +0000
                Re: va_start without the first argument? Keith Thompson <kst-u@mib.org> - 2017-03-14 11:34 -0700
                Re: va_start without the first argument? scott@slp53.sl.home (Scott Lurndal) - 2017-03-14 18:54 +0000
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-14 13:30 -0700
                Re: va_start without the first argument? Ike Naar <ike@iceland.freeshell.org> - 2017-03-15 21:55 +0000
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-15 15:16 -0700
                Re: va_start without the first argument? Philip Lantz <prl@canterey.us> - 2017-03-23 21:04 -0700
                Re: va_start without the first argument? David Brown <david.brown@hesbynett.no> - 2017-03-14 21:48 +0100
                Re: va_start without the first argument? scott@slp53.sl.home (Scott Lurndal) - 2017-03-14 14:01 +0000
                Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-14 07:42 -0700
                Re: va_start without the first argument? scott@slp53.sl.home (Scott Lurndal) - 2017-03-14 12:38 +0000
                Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-13 01:11 +0100
                Re: va_start without the first argument? Ian Collins <ian-news@hotmail.com> - 2017-03-13 15:43 +1300
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-13 10:36 +0000
                Re: va_start without the first argument? Ian Collins <ian-news@hotmail.com> - 2017-03-14 07:33 +1300
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-13 19:00 +0000
                Re: va_start without the first argument? Ian Collins <ian-news@hotmail.com> - 2017-03-14 08:05 +1300
                Re: va_start without the first argument? BartC <bc@freeuk.com> - 2017-03-13 23:10 +0000
                Re: va_start without the first argument? Ian Collins <ian-news@hotmail.com> - 2017-03-14 17:38 +1300
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-14 05:48 -0700
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 12:12 -0700
                Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-12 19:39 +0100
  Re: va_start without the first argument? jt@toerring.de (Jens Thoms Toerring) - 2017-03-10 20:49 +0000
    Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-10 14:41 -0800
      Re: va_start without the first argument? John Bode <jfbode1029@gmail.com> - 2017-03-10 16:05 -0800
        Re: va_start without the first argument? jacob navia <jacob@jacob.remcomp.fr> - 2017-03-11 21:47 +0100
          Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-11 13:07 -0800
            Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-11 22:24 +0100
              Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 05:44 -0700
                Re: va_start without the first argument? Jerry Stuckle <jstucklex@attglobal.net> - 2017-03-13 08:59 -0400
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 06:17 -0700
                Re: va_start without the first argument? Jerry Stuckle <jstucklex@attglobal.net> - 2017-03-13 13:27 -0400
                Re: va_start without the first argument? Jerry Stuckle <jstucklex@attglobal.net> - 2017-03-13 13:30 -0400
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 11:00 -0700
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 10:34 -0700
          Re: va_start without the first argument? antispam@math.uni.wroc.pl - 2017-03-12 06:00 +0000
          Re: va_start without the first argument? gordonb.gas5o@burditt.org (Gordon Burditt) - 2017-03-17 09:46 -0500
            Re: va_start without the first argument? supercat@casperkitty.com - 2017-03-17 09:07 -0700
        Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 05:39 -0700
          Re: va_start without the first argument? John Bode <jfbode1029@gmail.com> - 2017-03-13 11:40 -0700
            Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 12:01 -0700
              Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-13 23:17 +0100
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 16:15 -0700
                Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-14 00:26 +0100
                Re: va_start without the first argument? kikiins@gmail.com - 2017-03-13 16:51 -0700
                Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-14 01:12 +0100
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 18:24 -0700
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-13 18:57 -0700
                Re: va_start without the first argument? raltbos@xs4all.nl (Richard Bos) - 2017-03-14 07:59 +0000
                Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-14 06:45 -0700
                Re: va_start without the first argument? Robert Wessel <robertwessel2@yahoo.com> - 2017-03-13 18:20 -0500
                Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-14 00:31 +0100
    Re: va_start without the first argument? raltbos@xs4all.nl (Richard Bos) - 2017-03-13 16:51 +0000
  Re: va_start without the first argument? jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-11 19:29 +0100
  Re: va_start without the first argument? Siri Cruise <chine.bleu@yahoo.com> - 2017-03-11 12:12 -0800
  Re: va_start without the first argument? luser droog <luser.droog@gmail.com> - 2017-03-13 05:37 -0700
    Re: va_start without the first argument? luser droog <luser.droog@gmail.com> - 2017-03-15 11:45 -0700
      Re: va_start without the first argument? Thiago Adams <thiago.adams@gmail.com> - 2017-03-15 13:39 -0700

csiph-web