Click here to Skip to main content
15,885,951 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
kalberts30-Jun-20 3:02
kalberts30-Jun-20 3:02 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 3:28
professionalDavid O'Neil30-Jun-20 3:28 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 4:27
professionalDavid O'Neil30-Jun-20 4:27 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas30-Jun-20 7:23
professionalGreg Utas30-Jun-20 7:23 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 7:55
professionalDavid O'Neil30-Jun-20 7:55 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas30-Jun-20 8:15
professionalGreg Utas30-Jun-20 8:15 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 9:06
professionalDavid O'Neil30-Jun-20 9:06 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
kalberts30-Jun-20 10:18
kalberts30-Jun-20 10:18 
Greg Utas wrote:
Linux was first released almost 30 years ago. Since then, compilers have gotten much better at producing efficient code for C++.
That reminds me of of one paper I read years ago, from a "History of Programming Languages" international conference (I only read the papers, I wasn't present). This one lady who had been involved in the development of Fortran II, a pioneer compiler with respect to optimzation techniques. (A significant number of the tricks we now consider the very foundation of code optimization had their debut in Fortran II.) She told that even though they had themselves programmed the optimization functions, they frequently asked each other: How the elephant did the compiler discover that it could do that? And is it valid, is the generated code functionally equivalent to the unoptimized one? ... It turned out that the compiler was right; it had discovered (valid) rewritings that they would never have thought of themselves, according to this presenter.

Fortran II was released in 1958. As you point out: Compiler guys have learnt lots of supplementary tricks since then. Yet: Inefficient code generated by compilers from the 1980s and 1990s is mostly due to the compiler writers being unaware of methods that had been known for decennies in other parts of the programming community.

Another aspect is that neither K nor R were recognized as language/compiler designers when they set out to define the C language (with R as the driving force in the language definition). They did not design a language well suited for neither code optimization, unambiguity nor other "academic" qualities. It grew out of assembler, not out of high level modeling concept. So they created a language a lot harder to optimize than other contemporary languages. E.g. the very free use of pointers, possibly typeless, may require quite extensive flow analysis to determine if an optimization is valid or not.

My personal experience: I grew up with a scepticism to automatic garbarge collection. When starting with C#, I was seriously considering adopting some of my old code from earlier projects for managing my own lists of discarded memory blocks, for later reuse without having to invoke the system heap management function. Then I got hold of a description of the dotNet memory management. As I read, several times I nodded: That is smart - I never thought of that myself! ... So before I had read the description to the end, I was turned into a GC devotee.

Nowadays, I classify people who claim to do memory management better than any GC along with those who claim to write C code in such a way that there is nothing left for any code optimization to do. I grant everyone the right to such self confidence (both wrt. code optimization and GC), but I am not willing to take their word for it. Certainly not if we are talking about general programming. Those special cases where hand carving is claimed to be required are extremely few and far between. Most "special cases" are far from special real cases, but highly synthetic, constructed cases having nothing whatsoever to do with real world applications.
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas30-Jun-20 13:15
professionalGreg Utas30-Jun-20 13:15 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
honey the codewitch29-Jun-20 15:51
mvahoney the codewitch29-Jun-20 15:51 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
honey the codewitch29-Jun-20 15:46
mvahoney the codewitch29-Jun-20 15:46 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil29-Jun-20 16:08
professionalDavid O'Neil29-Jun-20 16:08 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Richard MacCutchan29-Jun-20 21:43
mveRichard MacCutchan29-Jun-20 21:43 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 3:10
professionalDavid O'Neil30-Jun-20 3:10 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Richard MacCutchan30-Jun-20 3:26
mveRichard MacCutchan30-Jun-20 3:26 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Richard MacCutchan30-Jun-20 3:51
mveRichard MacCutchan30-Jun-20 3:51 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 4:24
professionalDavid O'Neil30-Jun-20 4:24 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Nelek29-Jun-20 9:56
protectorNelek29-Jun-20 9:56 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Sander Rossel29-Jun-20 11:36
professionalSander Rossel29-Jun-20 11:36 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Nelek29-Jun-20 12:08
protectorNelek29-Jun-20 12:08 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
honey the codewitch29-Jun-20 15:48
mvahoney the codewitch29-Jun-20 15:48 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Sander Rossel29-Jun-20 21:02
professionalSander Rossel29-Jun-20 21:02 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Garth J Lancaster29-Jun-20 13:12
professionalGarth J Lancaster29-Jun-20 13:12 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
honey the codewitch29-Jun-20 14:23
mvahoney the codewitch29-Jun-20 14:23 
GeneralThought of the Day Pin
OriginalGriff29-Jun-20 4:45
mveOriginalGriff29-Jun-20 4:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.