General > General Technical Chat
How many people code in C these days, and if so, why?
engrguy42:
--- Quote from: bd139 on May 09, 2020, 05:19:04 pm ---
--- Quote from: engrguy42 on May 09, 2020, 05:08:10 pm ---Oh, and a simple raytracer I wrote last year in C++. Can't do that shit in C#.
--- End quote ---
?
--- End quote ---
Wow. You got me on that one. :-DD
intmpe:
C is typical for small microcontrollers like the PIC and even the ARM.
Having said that most "good" c compiler vendors will provide libraries to perform functions that would otherwise require a lot of coding - i.e. fractional mathematics and a bunch of other stuff that the microcrontroller does not natively support. They provide libraries to bit bang pins, software rs232, lcd code ... the list goes on and on.
So even if you do buy a C compiler its not a complete pain in the ass like it was in the old days (I personally used to hate the language), but with the libraries I am satisfied enough. I am still pissed that the pricks who wrote if thought it was a good idea to put a ; a the end of every line. The syntax sucks ass and is unnecessary. Even pascal had better syntax but the purists would never accept that. Delpi though has gone open source - it still has a following. There is a guy in Adelaide with an Oberon based compiler and mikroelectronica sell their compilers in C, Basic and Pascal so the environement and choice is still rich. Pascal is still alive and kicking from several sources.
On the other hand if you program using Visual Studio on the PC desktop, you have the choice of C# and VB. Now I have used both and was once also a Quickbasic programmer. Quickbasic was structured basic. VB.net is only notionally related to basic. Sure some of the syntax is there but Visual Studio forces you to write code in an object orientated way so if you were transported from 1985 using the dos basic compiler to todays vb.net you would be completely lost and it would only be vaguely related to basic.
On the other hand it is relatively simple to convert C#.net to VB.net and back again. The syntax is slightly different but Visual Studio forces the same code structure so I have done that many times - either one is usable and I don't consider them to be much different. VB.net used to be the most widely used desktop language in the world but Microsoft stopped publishing the download numbers (probably when they integrated them all together - you can mix vb.net and c# code blocks in a single project) - besides it was probably embarrassing - I mean look what happened to J# .. they had to kill it off. C++ proper is in Visual studio but I would say it is no where near as popular as the other two as it was developed earlier and lacks the same code structure as the .net languages. Of course if you are on linux or the desktop you can use c++ in VS or g++ as a front end to gcc. Basically if you have a favourite language for a chip there is probably a compiler for it.
Ironically for the first time in 20 odd years I have had to recently write code for the PIC using assember for speed.
Berni:
No raytracing in C#? Here is one then done completely in C# then:
https://github.com/mellinoe/veldrid-raytracer
As a bonus it also translates the C# code into shader scripts to execute on the GPU. But go ahead and compare even the CPU only version for speed.
Yes we know C# is typically not quite as fast as C++, but with some care to optimize things it gets the same sort of ballpark performance. You can't really objectively say if C++ or C# is better. They are good at different things, but they are both powerful languages that can do a lot.
Its the programmer behind the keyboard that determines the performance of the code, the language just gives him the tools to do it.
SiliconWizard:
--- Quote from: engrguy42 on May 09, 2020, 05:18:35 pm ---
--- Quote from: bd139 on May 09, 2020, 05:15:50 pm ---https://github.com/lukehoban/LINQ-raytracer/blob/master/LINQRayTracer.cs ?
--- End quote ---
And your point is.....???
--- End quote ---
What exactly was yours? Guess he just posted that to show it was possible (and of course it is - as long as you have reasonable FP support, I don't see how you could not write a raytracer in almost any language. Heck, I guess you could even write one with pure fixed point too, although that would require some serious thinking.)
"Can't do that shit in C#."
With that formulation, we actually don't know whether this was meant as a general statement (which then is obviously wrong), or simply that YOU can't write a raytracer in C#. Which is completely possible and even a fair point, but then I guess you should maybe express things in a bit clearer way so we know your intent is to talk about what YOU use and why (which is on-topic indeed), rather than make it pass as a general fact.
engrguy42:
I humbly apologize for making an inaccurate comment. Humbly. It was a terrible mistake. I'm duly ashamed. I now realize that even slightly inaccurate comments have no place on this forum.
Yes, you can use C# for raytracing. I was merely basing it on my experience whereby CUDA (NIVDIA's GPU API) is pretty much reliant on C/C++, and that's what I was using.
But yes, there are exceptions.
My bad. I'm a very very very bad boy.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version