Repository navigation
Fix/c formatting - #275
Fix/c formatting#275
Conversation
| default: throw new NotImplementedException(); | ||
| [UnscopedRef] | ||
| public ref ScanF Read(out int i) { | ||
| Unsafe.SkipInit(out i); |
There was a problem hiding this comment.
Why SkipInit and not setting it to default? Is this how the original works? I believe it would just zero it out...
There was a problem hiding this comment.
No, C doesn't zero them, it leaves them untouched Border.ApplySchemeSettings use it/rely on this (original):
Source.NET/Source.GUI/Border.cs
Lines 69 to 71 in d31372e
For example, here right and bottom keep their values
#include <stdio.h>
int main(void)
{
int left = 11, top = 22, right = 33, bottom = 44;
int n = sscanf("2 2", "%d %d %d %d", &left, &top, &right, &bottom);
printf("sscanf(\"2 2\", \"%%d %%d %%d %%d\") returned %d\n", n);
printf("left=%d top=%d right=%d bottom=%d\n", left, top, right, bottom);
return 0;
}
There was a problem hiding this comment.
I would say that we should have out vs ref functions instead, separated. So ref requires initialization and out does not. I just don't like breaking the out semantics
There was a problem hiding this comment.
Read(out) now zeroes & ReadOrKeep(ref) keeps C leave-untouched behaviour (where the C++ relies on it)
|
also merge conflicts now |
5181786 to
9c0b471
Compare
Should be good |
No description provided.