Compiling with g++ using multiple cores
Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? 8 Answers 8
Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? 8 Answers 8
I want to programmatically edit python source code. Basically I want to read a .py file, generate the AST, and then write back the modified python source code (i.e. another .py file). There are ways to parse/compile python source code using standard python modules, such as ast or compiler. However, I don’t think any of … Read more
What is the reason for the following warning in some C++ compilers? No newline at end of file Why should I have an empty line at the end of a source/header file? 11 Answers 11
Suppose I have an if statement with a return. From the efficiency perspective, should I use if(A > B): return A+1 return A-1 or if(A > B): return A+1 else: return A-1 Should I prefer one or another when using a compiled language (C) or a scripted one (Python)? 9 Answers 9
Core is GHC’s intermediate language. Reading Core can help you better understand the performance of your program. Someone asked me for documentation or tutorials on reading Core, but I couldn’t find much. What documentation is available for reading GHC Core? Here’s what I’ve found so far: Write Haskell as fast as C: exploiting strictness, laziness … Read more
In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don’t have name collision? For example: foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; static int bar = 20; foo++; foo++; bar++; bar++; … Read more
Recently I met the following exception at C# solution: Error 2 Could not load file or assembly ‘Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b9a188c8922137c6’ or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) This does not depend either on my code or on the name of assembly (like Newtonsoft.Json in this case). When … Read more
Intuitively, it would seems that a compiler for language Foo cannot itself be written in Foo. More specifically, the first compiler for language Foo cannot be written in Foo, but any subsequent compiler could be written for Foo. But is this actually true? I have some very vague recollection of reading about a language whose … Read more
Intuitively, it would seems that a compiler for language Foo cannot itself be written in Foo. More specifically, the first compiler for language Foo cannot be written in Foo, but any subsequent compiler could be written for Foo. But is this actually true? I have some very vague recollection of reading about a language whose … Read more
I’ve Googled and poked around the Go website, but I can’t find an explanation for Go’s extraordinary build times. Are they products of the language features (or lack thereof), a highly optimized compiler, or something else? I’m not trying to promote Go; I’m just curious. 11 Answers 11