It's been said more than once: C is a write-only language.
Catalina: Apple turns macOS into a closed platform; many audio-devs warned from the upgrade
- KVRAF
- 2249 posts since 25 Sep, 2014 from Specific Northwest
I think C could be greatly improved with losing the braces and semicolons and using the Python 2-space indent scheme. It would certainly make some of my code far more readable.mystran wrote: ↑Sun Nov 10, 2019 7:29 pmYou need whitespace for the preprocessor and qualifiers and non-pointer definitions/declarations (can't think of a workaround for those; excessive parens might work)... but I think that's pretty much all of it in plain C. In C++ you also need some in nested templates, but not sure if there's anything else.
Now, if we could only get rid of header files. What a waste when the preprocessor can do one pass over the code file, followed by the compiler.
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better?
-
- KVRist
- 135 posts since 9 Apr, 2017
- KVRAF
- 7899 posts since 12 Feb, 2006 from Helsinki, Finland
With C++ it sometimes feels like it's instead better to just avoid source files (and with templates you basically have to do it anyway), except for stuff that's more or less independent of everything else or part of some stable module that haven't changed for a while.
The problem is that there's a minimum "critical mass" that you have to reach before the separate compilation saves you more time than the overhead of having to compile another file (and this gets worse when the file itself has to include a lot of stuff). For relatively small source files with enough dependencies that you end up having to recompile often and which themselves provides functionality that is only imported by a few other files, you can actually end up saving time (and sometimes a lot of time) by simply dumping it all into the header directly.
- KVRAF
- 2249 posts since 25 Sep, 2014 from Specific Northwest
C++ is really it's own sort of monster. I'm not horribly keen on templates to begin with. They're ugly, slow and quite pointless to me in the way I work. And with its very heavy reliance on templates, it makes the C++ compiler one of the slowest, fussiest of compilers. But I'm really speaking from the view of the programmer, i.e. me, that I have to define prototypes and then define the exact same thing in a separate file. I'd rather have a single file with my data structures defined at the top, followed by procedures, classes and methods that I only have to name once, which is pretty much every other language out there that's not in the C-family.
Maybe there could be a separate templates file? C++ would benefit in incremental compilation by not having to recompile headers every time one might be changed, but just recompiling the single file that did change. I've just started automatically cleaning and recompiling all my C++ code as I'm tired of fighting with Xcode.
Me: Xcode, please recompile my changes.
X: Done!
Me: Um, no, you didn't do anything there.
X: Yes, I did.
Me: Then why is that bug I just fixed still there?
X: Hey, man, don't blame me for your crappy code...
I realize this is more Xcode's fault more than clang, but we like or mod cons, right? Fortunately, my compile time is only a few seconds.
Maybe there could be a separate templates file? C++ would benefit in incremental compilation by not having to recompile headers every time one might be changed, but just recompiling the single file that did change. I've just started automatically cleaning and recompiling all my C++ code as I'm tired of fighting with Xcode.
Me: Xcode, please recompile my changes.
X: Done!
Me: Um, no, you didn't do anything there.
X: Yes, I did.
Me: Then why is that bug I just fixed still there?
X: Hey, man, don't blame me for your crappy code...
I realize this is more Xcode's fault more than clang, but we like or mod cons, right? Fortunately, my compile time is only a few seconds.
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better?
- KVRAF
- Topic Starter
- 1748 posts since 2 Jul, 2018
Experiencing these sort of problems also frequently with XCode on the Mac. If you want to be sure that your code changes REALLY got applied always clean the build and rebuild completely. Then compiling takes a looong time...
And if you want to test the AU always close the host complelety. Otherwise it loads the old AU and does not apply the changes. Seems to be a caching problem.
It makes debugging a AU plugin a pain on the Mac.
It does not occur with VST.
It also happens with Visual Studio on PC. But only if you change from debug to release build or from X64 to x32.
And if you want to test the AU always close the host complelety. Otherwise it loads the old AU and does not apply the changes. Seems to be a caching problem.
It makes debugging a AU plugin a pain on the Mac.
It does not occur with VST.
It also happens with Visual Studio on PC. But only if you change from debug to release build or from X64 to x32.