back
user profile
uecker
2,145karma·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
Why surprisingly? In pre-ANSI C is it only possible because there was no type safety. In other languages it could work by deriving the type from the call, but this does not work in C.
comment
gaslightning...
comment
Right, it works well even without it.
comment
The non-generic special parts that were needed in the past can easily be ignored. At its core it is a generic buffer management protocol and it obviously has all the parts for generic buffer managemen…
comment
It works perfectly for me. Inefficiencies could easily be fixed by extensions if necessary. The main thing which is missing in practice is latency hiding. But this is supported by the X protocol just …
comment
It would be good if interested parts of the community maintained its own fork of Gtk3 and get involved with X development to keep it alive.
comment
The sad thing is that X barely sees development and will die if nobody steps up to maintain it. I hope somebody does, I like it much more than Wayland (not monolithic, first-class network transparenc…
comment
I am not sure I follow. unsigned types in C are residues and not binary polynoms or Galois fields (also you can of course store them in unsigned integers). The conversions work, e.g. conversion to a s…
comment
Sanitizers / checkers are much useful if the behavior is defined, because you can then not be sure it is not intentionally used in the way allowed by the definition. So you can not check at run-t…
comment
In reality people use unsafe to optimize and then introduce bugs. You could also use a safe abstractions to avoid bounds violations in C.
comment
Indeed it is a shame. All bloated. It would be nice to have small and lean tool chain again.
comment
There was a similar bug in the past in Rust: Integer overflow causing a buffer overflow:
https://github.com/rust-lang/rust/pull/54399/commits/8ac88d3... So th…
comment
GCC only works in the first case anyway: https://godbolt.org/z/jo57r1MW4
One could add in the other too, but language semantics currently do not allow this. Changing the n late…
comment
Actually, the spec does not say exactly "the language spec can't guarantee anything". It says "undefined behavior --- behavior, upon use of a nonportable or erroneous program const…
comment
Those ideas are not convincing. Consider the glibc bug from yesterday. If I understood it correctly, there is an integer overflow causing a heap overflow. The integer overflow was unsigned wraparound …
comment
Actually the definition of UB is not "compilers can assume UB does not exist" but indeed "the language spec can't guarantee anything". We clarified this in the C23 spec. …
comment
You could pass a pointer to the array instead of letting it decay: int get(int n, char (*buffer)[n])
{
return buffer[10];
} int main()
{
char buffer[10];
get(10, &buffer);
} Then a run-time …
comment
There exist many C compilers written in C, while only relatively few C++ compilers even exist. And while gcc is technically written in C++, large parts still look like C. OS pushed by big corps defini…
comment
I would say X was success. It could be modernized via extensions, while maintaining backwards compatibility and providing network transparency. And it still works well, while the the replacement whic…
comment
You are right that you can build a lot of overly complicated crap on top of simpler systems. Android or the modern web are good examples. But in the long run it is usually not the overly complicated …
comment
The comment I was responding to talked about the rise of GNU which allegedly killed better systems that used C++. I argue that GNU won because it was a better system and that it used C and not C++ is…
comment
You do not need to wrap arrays into structs to prevent decay. You just take the address as you would do for any other type: https://godbolt.org/z/Y73j8a7Yf …
comment
I agree with the criticism that one should not mimick C++ in C. A good C library would use intrusive data structures, user-controlled memory allocations, not try to replace built-in types (arrays) wit…
comment
The UNIX model won over object approaches. And I think there is a reason: The simplicity of flat memory model, C, a unified file interface etc. removes a lot of complexity and allows composition of d…
comment
There is plenty of old C code, this is irrelevant. Equally irrelevant is that you found a library that uses a void pointer. I can show type unsafe C++ code as well, and would be equally meaningless. W…
comment
I am not sure I agree. What is allowed by the typing rules should always be clear. What may not always be clear is whether you statically get an error during compilation or only a run-time error. But …
comment
Thanks. I agree that data structures are even more important. So I plan to make this for for data structures too (this is not a full proposal yet, just testing the waters): #define foo(tag, T) struc…
comment
It is not more unsafe than fixed-sized arrays on the stack and stack clash protection (which you need anyway) protects against this. Also if you compare with C++ and use std::vector, surprise, a CVE …
comment
It seems some things are crystal clear to you because you are already used to them, but here you do not "see" how this will work, so you have your doubts. Fair enough. To me it is crystal cl…
comment
Ok, let's debunk this point for point:
- passing incompatible types is a constraint error in C just as in C++. Whether this is a warning or not depends on the compiler and on compiler flags. And …