back
user profile

uecker

2,141karma·1,822submissions·April 14, 2020
about
Computational Magnetic Resonance Imaging, Real-time Magnetic Resonance Imaging, GCC Contributor, BART Toolbox, Member of ISO C WG14
recent activity (1,822 total)
comment
Regarding function syntax in C++: GCC's C++ frontend does not support nested functions. But more importantly, even if it did, I do not think there would be any conflict at all. While lambdas are …
23h ago·view thread
comment
GCC's nested functions can also capture variables by reference. A closure combines the function with the environment which is essentially what my wide pointer is that contains the static chain th…
1d ago·view thread
comment
Fair. If you only have one object to access such as the target pointer, then it probably makes not much difference with void-pointer based APIs such as qsort_r (for new APIs it would add type safety).…
1d ago·view thread
comment
I agree with your point. But I usually prefer the later anyway, because the code usually is not as nested anyway and having a name is often helpful, and also because I find the nested code with lambda…
1d ago·view thread
comment
Or without qsort_r, you could use a thread local variable: typedef typeof(dsq) dsq_f; _Thread_local static wide(dsq_f) wdsq; wdsq = CLOSURE(dsq_f, dsq); https://godbolt.org…
1d ago·view thread
comment
This is a good example. Without trampolines, this could look like this (Godbolt: https://godbolt.org/z/nK5fqMxjs ). int main() { struct Point { int x, y;…
1d ago·view thread
comment
C++ has the same solution as I propose here: A wide function pointer type. In C++ it is called std::function, but this comes with a bit of baggage. C++ 26 has std::function_ref which would be the exac…
1d ago·view thread
comment
I agree if your language is designed like this from the beginning as functional languages are, but in C you already have different syntax for functions. (edit: rephrased)
1d ago·view thread
comment
Correct (although the nightmare part is a bit exaggerated since return-oriented programming showed that non-executable stack does not help a lot). GCC can also put the trampoline on the heap, but thi…
1d ago·view thread
comment
Lambdas are just anonymous nested functions. But I like named nested functions more because they are more readable and would prefer them in most cases. Ideally you have both as most languages have. I …
1d ago·view thread
comment
My old patch from 2018? This was not accepted to GCC because it relied on function pointers being aligned and there were concerns with this. But I prefer this approach anyhow, as it does not impose an…
1d ago·view thread
comment
I don't understand this comment. There are well-defined ABIs for many platforms. Sometimes there is a defacto ABI defined by the first compiler supporting this platform, but generally there ABI g…
1d ago·view thread
comment
You are right that there are cases where it is not possible. But it also works when arguments are not passed in registers. The condition then is that there are less stack slots used than in the caller…
1d ago·view thread
comment
That version would at least warn with -Wall.
2d ago·view thread
comment
What specific examples do you have in mind where you would get a useful warning with a C++ compiler that you can not also get for C with gcc?
2d ago·view thread
comment
GCC warns by default since version 5, released more than a decade ago.
2d ago·view thread
comment
Yes, g++ -xc will call the regular C FE. So yes, do not try to compile C code using a C++ compiler. That you somehow get superior type checking with C++ is not really true anymore, as essentially all …
2d ago·view thread
comment
Renewables is more economical than nuclear, so investing in nuclear is a waste of resources. This is also why nobody does it. And no, nobody who hasn't lost their marbles is seriously considering…
3d ago·view thread
comment
We haven't reached peak coal because we did not start developing renewables earlier. We did waste a huge amount of resources in nuclear in the past, which still never became cheap enough. That we…
3d ago·view thread
comment
No, because nuclear energy is not a cost effective measure against climate change. Solar is.
4d ago·view thread
comment
Backdoored developers are ok?
4d ago·view thread
comment
I do not blindly trust anything, and come to the conclusion that downloading binaries from Debian trixie is a lot more safe. There is a world of difference between "curl | sh" and downloadin…
4d ago·view thread
comment
Yes, it does not solve the problems described there.
5d ago·view thread
comment
It is also relevant for dynamic linking on all Linux binary distributions.
5d ago·view thread
comment
Indeed, it now admits this. But what problem is this then really solving?
5d ago·view thread
comment
Huh, compiler interoperability is extremely useful. It usually works by ABI groups defining a common ABI for each architecture and compilers then following these ABIs (although not required a compiler…
5d ago·view thread
comment
Yes, using an arbitrary type that is different from the one of the object is UB. But any access of a representation byte using a character pointer is well defined, not just memcpy and I would also not…
5d ago·view thread
comment
Yes, Rust copied many good ideas from C (and added many new). BTW: If you use character-pointers, you also do not need to worry about strict-aliasing in C.
5d ago·view thread
comment
Maybe provide a concrete example instead of making vague accusations. Or rather, please not, it is not a useful discourse. A productive response to my comment would be an insightful explanation of how…
5d ago·view thread