Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch > #32151 > unrolled thread
| Started by | Ramine <ramine@1.1> |
|---|---|
| First post | 2015-12-26 13:56 -0800 |
| Last post | 2015-12-27 07:23 -0800 |
| Articles | 18 — 11 participants |
Back to article view | Back to comp.arch
Here is what i think of C and C++ Ramine <ramine@1.1> - 2015-12-26 13:56 -0800
Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-26 11:07 -0800
Re: Here is what i think of C and C++ Quadibloc <jsavard@ecn.ab.ca> - 2015-12-26 12:17 -0800
Re: Here is what i think of C and C++ jim.brakefield@ieee.org - 2015-12-26 16:31 -0800
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-27 11:39 -0800
Re: Here is what i think of C and C++ George Neuner <gneuner2@comcast.net> - 2015-12-28 14:16 -0500
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-26 16:36 -0500
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-26 14:14 -0800
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-27 10:46 -0500
Re: Here is what i think of C and C++ BGB <cr88192@hotmail.com> - 2015-12-27 09:50 -0600
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-27 09:57 -0800
Re: Here is what i think of C and C++ anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-27 17:43 +0000
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-28 00:18 -0500
Re: Here is what i think of C and C++ Walter Banks <walter@bytecraft.com> - 2015-12-28 00:30 -0500
Re: Here is what i think of C and C++ Anonymous <no_email@invalid.invalid> - 2015-12-27 04:27 +0000
Re: Here is what i think of C and C++ "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-12-27 09:44 -0800
Re: Here is what i think of C and C++ EricP <ThatWouldBeTelling@thevillage.com> - 2015-12-27 16:35 -0500
Re: Here is what i think of C and C++ Megol <golem960@gmail.com> - 2015-12-27 07:23 -0800
| From | Ramine <ramine@1.1> |
|---|---|
| Date | 2015-12-26 13:56 -0800 |
| Subject | Here is what i think of C and C++ |
| Message-ID | <n5mnne$kjv$6@dont-email.me> |
Hello..... Here is why i don't accept C++ and C... Ada does discipline the programmer with strict rules. But C++ and C do not discipline you at the level of Ada. C and C++ require that you must be disciplined but it doesn't discipline you at the level of Ada with strict rules, and that's not good for realtime critical safety systems for example. So i will refrain from using C++ or C in favor of FreePascal and Dephi and Ada and Java. Thank you, Amine Moulay Ramdane.
[toc] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2015-12-26 11:07 -0800 |
| Message-ID | <fec45b86-9461-4bce-b8a3-0df45d49191f@googlegroups.com> |
| In reply to | #32151 |
C and C++ offer freedoms that gain performance. It requires more i-dotting and t-crossing, but will produce code that is often 2x (or more) faster than Ada or other languages which impose such restrictions, even if they are good implementations. Their strict type-checking rules require CPU time to implement. Best regards, Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | Quadibloc <jsavard@ecn.ab.ca> |
|---|---|
| Date | 2015-12-26 12:17 -0800 |
| Message-ID | <79817343-ae08-4942-9011-2ce26719c2a4@googlegroups.com> |
| In reply to | #32153 |
On Saturday, December 26, 2015 at 12:07:12 PM UTC-7, Rick C. Hodgin wrote: > Their strict type-checking > rules require CPU time to implement. Huh? Bounds checking certainly requires CPU time, but isn't type checking all done at compile time? The freedom provided by C, of course, is needed for some purposes, so having it doesn't make C a "bad" language - something for general purposes that would be less strict than some languages, but a better fit than C, would be nice. However, the popularity of a language is also very important, making it unlikely progress will be made any time soon. John Savard
[toc] | [prev] | [next] | [standalone]
| From | jim.brakefield@ieee.org |
|---|---|
| Date | 2015-12-26 16:31 -0800 |
| Message-ID | <cbb465de-e259-4b2f-843d-8b01a630a615@googlegroups.com> |
| In reply to | #32154 |
On Saturday, December 26, 2015 at 2:17:05 PM UTC-6, Quadibloc wrote: > On Saturday, December 26, 2015 at 12:07:12 PM UTC-7, Rick C. Hodgin wrote: > > Their strict type-checking > > rules require CPU time to implement. > > Huh? Bounds checking certainly requires CPU time, but isn't type checking all > done at compile time? > > The freedom provided by C, of course, is needed for some purposes, so having it > doesn't make C a "bad" language - something for general purposes that would be > less strict than some languages, but a better fit than C, would be nice. > However, the popularity of a language is also very important, making it > unlikely progress will be made any time soon. > > John Savard John Savard: Bounds checking certainly requires CPU time, but isn't type checking all done at compile time? IMHO: Across the spectrum of programming languages, various calculations including type inference and bounds checking occur in various places. A "smart" compiler will move as much calculation as far forward as possible (e.g. outside loops, to compilation time, etc.), the degree to which this can be done varies with each language. (treating the program as an expression graph; graph reduction, e.g. calculation, can be done in bits and pieces whenever the operands become known). From this very general perspective, the human activity of programming becomes one of choosing the most appropriate abstraction of the computation and hopefully letting the compiler do as much of the details as possible. I like type checking (and for that matter any kind of error checking) and wish that bounds checking can be moved out of loops. Which brings up the issue of address checking. C lets one do address manipulations with abandon. So one should also have the compiler do address checking. ADA and other such languages try to restrict use of addresses for this very purpose. One could propose a version of C that somehow implements an option for address checking? Jim Brakefield
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2015-12-27 11:39 -0800 |
| Message-ID | <caf86240-a85f-4e0e-a322-f8836a36dfa3@googlegroups.com> |
| In reply to | #32162 |
Jim Brakefield wrote:
> ...One could propose a version of C that somehow implements an option for
> address checking?
This was discussed recently on comp.lang.c:
"Rethinking the machine expression of traditional C language conventions"
https://groups.google.com/d/msg/comp.lang.c/gcCw1kwWPfM/bKTfcv0iBwAJ
Best regards,
Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | George Neuner <gneuner2@comcast.net> |
|---|---|
| Date | 2015-12-28 14:16 -0500 |
| Message-ID | <pd238bde7j6agl2udn4ko77775d76g752s@4ax.com> |
| In reply to | #32154 |
On Sat, 26 Dec 2015 12:17:03 -0800 (PST), Quadibloc <jsavard@ecn.ab.ca> wrote: >On Saturday, December 26, 2015 at 12:07:12 PM UTC-7, Rick C. Hodgin wrote: >> Their strict type-checking >> rules require CPU time to implement. > >Huh? Bounds checking certainly requires CPU time, but isn't type checking all >done at compile time? Yes and no. There is type-related value checking that often only can be done at runtime. George
[toc] | [prev] | [next] | [standalone]
| From | Walter Banks <walter@bytecraft.com> |
|---|---|
| Date | 2015-12-26 16:36 -0500 |
| Message-ID | <n5n18a$jk9$1@speranza.aioe.org> |
| In reply to | #32153 |
On 26/12/2015 2:07 PM, Rick C. Hodgin wrote: > C and C++ offer freedoms that gain performance. It requires more > i-dotting and t-crossing, but will produce code that is often 2x (or more) > faster than Ada or other languages which impose such restrictions, > even if they are good implementations. Their strict type-checking > rules require CPU time to implement. Compile time or execution time? w..
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2015-12-26 14:14 -0800 |
| Message-ID | <01420908-cd92-4d55-9a0e-7078f72f19dd@googlegroups.com> |
| In reply to | #32155 |
Walter Banks: > Compile time or execution time? Execution time. Best regards, Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | Walter Banks <walter@bytecraft.com> |
|---|---|
| Date | 2015-12-27 10:46 -0500 |
| Message-ID | <n5p14v$knq$1@speranza.aioe.org> |
| In reply to | #32158 |
On 26/12/2015 2:07 PM, Rick C. Hodgin wrote: >> C and C++ offer freedoms that gain performance. It requires more >> i-dotting and t-crossing, but will produce code that is often 2x >> ormore) >> faster than Ada or other languages which impose such restrictions, >> even if they are good implementations. Their strict type-checking >> rules require CPU time to implement. > Walter Banks: >> Compile time or execution time? > > Execution time. > I have written compilers for both C and Pascal. Pascal and ADA type languages take more time to parse and validate source, but take significantly less time to optimize generated code. Although it is possible the run time code for Pascal and ADA could take longer to execute it is very unlikely in practice to be significantly different. Generated C code needs to account at run time for many things that Pascal/ADA type languages establish at compile time. The very type checking that occurs at compile time does a lot to simplify the generated code. w..
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2015-12-27 09:50 -0600 |
| Message-ID | <n5p1ls$ivm$1@news.albasani.net> |
| In reply to | #32175 |
On 12/27/2015 9:46 AM, Walter Banks wrote: > On 26/12/2015 2:07 PM, Rick C. Hodgin wrote: >>> C and C++ offer freedoms that gain performance. It requires more >>> i-dotting and t-crossing, but will produce code that is often 2x >>> ormore) >>> faster than Ada or other languages which impose such restrictions, >>> even if they are good implementations. Their strict type-checking >>> rules require CPU time to implement. > >> Walter Banks: >>> Compile time or execution time? >> >> Execution time. >> > > I have written compilers for both C and Pascal. Pascal and ADA type > languages take more time to parse and validate source, but take > significantly less time to optimize generated code. Although it is > possible the run time code for Pascal and ADA could take longer to > execute it is very unlikely in practice to be significantly different. > > Generated C code needs to account at run time for many things that > Pascal/ADA type languages establish at compile time. The very type > checking that occurs at compile time does a lot to simplify the > generated code. > this is an advantage of stronger typing. it allows the compiler to infer more about the behavior of values and memory, and to optimize for them. though, I consider this as a separate issue from needlessly pedantic compiler error messages or forcing the programmer to do things certain ways, which seems more what most people think of as strong typing... ex: mechanism before policy rather than policy before mechanism...
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2015-12-27 09:57 -0800 |
| Message-ID | <b293f102-9607-4a2a-8f55-5c2b28e0a61a@googlegroups.com> |
| In reply to | #32175 |
Walter Banks wrote: > Although it is possible the run time code for Pascal and ADA could take > longer to execute it is very unlikely in practice to be significantly different. I agree. On the whole even large discrepancies in performance will not matter because today's CPUs and GUI accelerators are fast enough for people tasks, and the labor savings in debugging more than exceed the loss on performance. I am working on a compiler framework like GCC called RDC (Rapid Development Compiler) that is designed to support full edit-and-continue on at all points, forgoing some optimizations to allow the speed of bug fixing in live and running libraries. It is being designed for an XBASE offshoot, and a C offshoot (called CAlive). I eventually plan to support Java, .NET, and now Ada (it was one of my considerations before, along with a few others, including D, Ruby, Pascal, Visual Basic, and Go). Best regards, Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2015-12-27 17:43 +0000 |
| Message-ID | <2015Dec27.184315@mips.complang.tuwien.ac.at> |
| In reply to | #32175 |
Walter Banks <walter@bytecraft.com> writes: >On 26/12/2015 2:07 PM, Rick C. Hodgin wrote: >>> C and C++ offer freedoms that gain performance. It requires more >>> i-dotting and t-crossing, but will produce code that is often 2x >>> ormore) >>> faster than Ada or other languages which impose such restrictions, >>> even if they are good implementations. Their strict type-checking >>> rules require CPU time to implement. > >> Walter Banks: >>> Compile time or execution time? >> >> Execution time. >> > >I have written compilers for both C and Pascal. Pascal and ADA type >languages take more time to parse and validate source, but take >significantly less time to optimize generated code. That is their choice. Of course, if you leave away things like induction variable elimination from a Pascal or Ada compiler, it will often hurt more than if you leave it away from a C compiler, because thanks to pointer arithmetics in C the programmers can eliminate induction variables in the source code that cannot be eliminated in the source code in Pascal or Ada. >Generated C code needs to account at run time for many things that >Pascal/ADA type languages establish at compile time. Such as? C compilers certainly don't type-check at run-time. Admittedly Pascal and Ada compilers have some alias information that well-behaved C compilers won't use, but that does not make much difference (see below), and as a Pascal and Ada fan you probably welcome the broken C compilers that make Pascal-like alias assumptions, and will perform the "optimizations" without proving that they won't change the behaviour of the program. As for "not much difference", Wang et al. <http://people.csail.mit.edu/nickolai/papers/wang-undef-2012-08-21.pdf> found that in all of the SPECint benchmarks, there was only one place where "strict aliasing" caused a measurable difference (6%-12% for that program, <1% for the overall SPECint result); the same benefit could be achieved by a small change in the source code of that program. >The very type >checking that occurs at compile time does a lot to simplify the >generated code. Example? - anton -- M. Anton Ertl Some things have to be seen to be believed anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen http://www.complang.tuwien.ac.at/anton/home.html
[toc] | [prev] | [next] | [standalone]
| From | Walter Banks <walter@bytecraft.com> |
|---|---|
| Date | 2015-12-28 00:18 -0500 |
| Message-ID | <n5qgnn$m46$1@speranza.aioe.org> |
| In reply to | #32182 |
On 27/12/2015 12:43 PM, Anton Ertl wrote: > Walter Banks <walter@bytecraft.com> writes: >> On 26/12/2015 2:07 PM, Rick C. Hodgin wrote: >>>> C and C++ offer freedoms that gain performance. It requires >>>> more i-dotting and t-crossing, but will produce code that is >>>> often 2x ormore) faster than Ada or other languages which >>>> impose such restrictions, even if they are good >>>> implementations. Their strict type-checking rules require CPU >>>> time to implement. >> >>> Walter Banks: >>>> Compile time or execution time? >>> >>> Execution time. >>> >> >> I have written compilers for both C and Pascal. Pascal and ADA >> type languages take more time to parse and validate source, but >> take significantly less time to optimize generated code. > > That is their choice. Of course, if you leave away things like > induction variable elimination from a Pascal or Ada compiler, it > will often hurt more than if you leave it away from a C compiler, > because thanks to pointer arithmetics in C the programmers can > eliminate induction variables in the source code that cannot be > eliminated in the source code in Pascal or Ada. > >> Generated C code needs to account at run time for many things that >> Pascal/ADA type languages establish at compile time. > > Such as? C compilers certainly don't type-check at run-time. > Admittedly Pascal and Ada compilers have some alias information that > well-behaved C compilers won't use, but that does not make much > difference (see below), and as a Pascal and Ada fan you probably > welcome the broken C compilers that make Pascal-like alias > assumptions, and will perform the "optimizations" without proving > that they won't change the behaviour of the program. > > As for "not much difference", Wang et al. > <http://people.csail.mit.edu/nickolai/papers/wang-undef-2012-08-21.pdf> > > found that in all of the SPECint benchmarks, there was only one place > where "strict aliasing" caused a measurable difference (6%-12% for > that program, <1% for the overall SPECint result); the same benefit > could be achieved by a small change in the source code of that > program. > >> The very type checking that occurs at compile time does a lot to >> simplify the generated code. > > Example? > I think that BGB basically answered this. The more you know about a program at compile time the more agressive you can be at optimizing the generated code. That is also the basis of the code generation differences I have seen. I am both a C fan and ADA/Pascal fan. I have preferences for one or the other depending on the application code. Put in perspective I have represented Canada at WG-14 working on C standards and have written C compilers in both C and Pascal. For compiler applications I prefer Pascal but have used C by choice for essentially all the embedded systems applications I have worked on. w..
[toc] | [prev] | [next] | [standalone]
| From | Walter Banks <walter@bytecraft.com> |
|---|---|
| Date | 2015-12-28 00:30 -0500 |
| Message-ID | <n5qhdd$n8g$1@speranza.aioe.org> |
| In reply to | #32182 |
On 27/12/2015 12:43 PM, Anton Ertl wrote: > ... as a Pascal and Ada fan you probably welcome the broken C > compilers that make Pascal-like alias assumptions, and will perform > the "optimizations" without proving that they won't change the > behaviour of the program. A point that I failed to address in the other post is I am not a big fan of grafting language features or approaches between languages. They rarely work out. The power of C is (or at least was) its low level approach to implementing applications. On that particular problem area C is very effective. w..
[toc] | [prev] | [next] | [standalone]
| From | Anonymous <no_email@invalid.invalid> |
|---|---|
| Date | 2015-12-27 04:27 +0000 |
| Message-ID | <de97m0Fd8bgU1@mid.individual.net> |
| In reply to | #32153 |
Rick C. Hodgin <rick.c.hodgin@gmail.com> wrote: > C and C++ offer freedoms that gain performance. It requires more > i-dotting and t-crossing, but will produce code that is often 2x (or more) > faster than Ada or other languages which impose such restrictions, Nope. See http://benchmarksgame.alioth.debian.org/u64q/ada.html > even if they are good implementations. Their strict type-checking > rules require CPU time to implement. My KDF9 emulator, in Ada 2012, runs about 2% faster with all checks disabled than it does with all checks enabled except in a small core set of routines. This is in part because the information-rich declarations of Ada allow the compiler to optimise away checks that it can deduce will always succeed. Also in part because many constructs are correct by construction and never need checks, e.g.: subtype index is m..n; -- m, n are variables a : array (index) of ..... for i in a'range loop a(i) := ...; end loop; A subscripting error in a(i) is simply impossible. The computer biz needs to seriously rethink its priorities. Getting the wrong answer faster is not a selling point any more. -- Bill Findlay
[toc] | [prev] | [next] | [standalone]
| From | "Rick C. Hodgin" <rick.c.hodgin@gmail.com> |
|---|---|
| Date | 2015-12-27 09:44 -0800 |
| Message-ID | <3947265a-81a4-447e-bd25-4d7c6f9627b8@googlegroups.com> |
| In reply to | #32170 |
Bill Findlay wrote: > Rick C. Hodgin wrote: > > C and C++ offer freedoms that gain performance. It requires more > > i-dotting and t-crossing, but will produce code that is often 2x (or more) > > faster than Ada or other languages which impose such restrictions, > > Nope. See http://benchmarksgame.alioth.debian.org/u64q/ada.html Even on that link, there are three tests showing a 2x improvement in C over Ada. Nonetheless, based on the other results I looked into the GNAT architecture. It uses the same GCC toolchain in post front-end processing and optimization resulting on oft-commensurate results. Very nice. I stand corrected. Best regards, Rick C. Hodgin
[toc] | [prev] | [next] | [standalone]
| From | EricP <ThatWouldBeTelling@thevillage.com> |
|---|---|
| Date | 2015-12-27 16:35 -0500 |
| Message-ID | <IRYfy.52296$QG6.36486@fx31.iad> |
| In reply to | #32170 |
Anonymous wrote: > Rick C. Hodgin <rick.c.hodgin@gmail.com> wrote: >> C and C++ offer freedoms that gain performance. It requires more >> i-dotting and t-crossing, but will produce code that is often 2x (or more) >> faster than Ada or other languages which impose such restrictions, > > Nope. See http://benchmarksgame.alioth.debian.org/u64q/ada.html > >> even if they are good implementations. Their strict type-checking >> rules require CPU time to implement. > > My KDF9 emulator, in Ada 2012, runs about 2% faster with all checks > disabled > than it does with all checks enabled except in a small core set of > routines. There are a number of recent experiments in adding checked arithmetic to C which reach similar conclusions, about 5%. For example: RICH: Automatically Protecting Against Integer-Based Vulnerabilities 2007 http://repository.cmu.edu/cgi/viewcontent.cgi?article=1017&context=ece One possible reason this unfounded rumors about checking costs may be because GCC has a compile option -trapv which uses trapping arithmetic. Unfortunately the implementation is horribly inefficient and costs 50% performance loss. This is because it replaces every operator with a subroutine call, and those subroutines implement the checked arithmetic in "portable" code generating many lines of code for even simple operations, and not even using things like the x86 overflow flag when available. That RICH paper show how to do it right, tapping into the GCC intermediate representation to implement optimal checks. Also, there are many papers where people tried to just drop arithmetic checks into existing C code to "fix it". That does not work. Some code is amenable to checks, in that it was written assuming non-wrapping arithmetic. However some code assumes modulo arithmetic so if you just plop checks in, it triggers false exceptions. And the two usages are intermixed often within the same subroutine so you cannot use compile options to help. This is why I see the best option for C as adding 2 checked integer data types, in addition to the modulo signed and unsigned data types, and let programmers add the wrapping checks as they see fit. And it lets the compiler generate efficient code. Some other helpful sourses: Understanding Integer Overflow in C/C++ 2012 http://www.cs.utah.edu/~regehr/papers/tosem15.pdf IntScope: Automatically Detecting Integer Overflow Vulnerability in X86 Binary Using Symbolic Execution 2009 http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.153.1801&rep=rep1&type=pdf Program Transformations to Fix C Integers 2013 http://www.munawarhafiz.com/research/intproblem/icse13_intproblem.pdf Eric
[toc] | [prev] | [next] | [standalone]
| From | Megol <golem960@gmail.com> |
|---|---|
| Date | 2015-12-27 07:23 -0800 |
| Message-ID | <1ee150ca-3506-4deb-925d-92642179d885@googlegroups.com> |
| In reply to | #32153 |
On Saturday, December 26, 2015 at 8:07:12 PM UTC+1, Rick C. Hodgin wrote: > C and C++ offer freedoms that gain performance. It requires more > i-dotting and t-crossing, but will produce code that is often 2x (or more) > faster than Ada or other languages which impose such restrictions, > even if they are good implementations. Their strict type-checking > rules require CPU time to implement. Have you ever used Ada? That is so wrong...
[toc] | [prev] | [standalone]
Back to top | Article view | comp.arch
csiph-web