1,544 karma · joined August 14, 2022
Besides, the duo make-delete is easy to understand, but I find disturbing that one has to call delete on objects allocated with
X=map[string][]proc(...){}
I think it breakes the symmetry.If that's the rationale for choosing which symbols should be allowed, then let's ban {} as they require AltGr+Shift in many layouts. And let's avoid <> (used as parentheses, e.g. for templates or XML tags, not as less-than/greater-than) because in ISO keyboards they loose all their symmetry. And what about shells, with /, one of the most used characters, relegated above 7 in many layouts?
Jokes apart, I like the choice of ^ or any other characters distinct from * for pointer dereference. To be more precise, I despise the use of the same symbol with different meaning. In C the same * is used for multiplication, pointer dereference and takes part in commments, too. You need full context to parse some cases, or you have to play with spaces:
(a)*(b) // multiplication or casted deref?
x/ *y // multiplication
x/*y // comment start
Same with & m&&n // logical and
m& &n // masked addressSurely you mean ~10 reallocations, because 2^10=1024, right?
Did I miss an asterisk here? One that adds "except apps that require a GPU, that access non-USB devices, those with anti-cheat..."
I only wish it supported C23...
On the other hand, they are also very motivated to have a large mass of data to train their AI.
Which of the two motivations wins, is debatable. Today I'd bet on AI.
The UB on the add happens in cases where all incarnations of abs() would fail as well, because there simply isn't a correct return value.
I use the Insert key, which would otherwise have no function.
The last part denounces that testing is not tought enough, and learning it may be beneficial for your career. It's never said that testing is better than TSA, just that we would need more.
No? It's the first thing that came to my mind when I've read RAII.
> when he dies, the company will buy back his share from his next of kin for less than he originally paid.
char buffer[64];
And then it's not used anywhere!I was curious about the "Why not printf" section, but I found code I don't understand there, too. For example this admittedly non-working snippet is cited as idiomatic:
char str[4] = {0};
int cursor = 0;
cursor += snprintf(str, sizeof str, "hello ");
cursor += snprintf(str, sizeof str, "world!");
Of corse this doesn't work (if the intent was to assemble the "hello world!" string, of which I'm not entirely sure), but not for the reason stated in TFA. You need to actually use cursor, not merely set it! :)It must be possible to sort all system events in an "absolute time line". To do so, the system must know in every moment at what point of this "absolute time line" we are, so that it can stamp the event with such absolute time marker.
Now, we can make it coincide with any known TZ, but once set, we must not change it. I set it to UTC; you might prefer your home TZ, if you have a place you call "home". But then don't change it when you travel or when switching DST on and off!
Of course you can still change the TZ of the time that's displayed to you (so that it's synchronized with the local church's bells, for example, which is convenient and might avoid you a lot of misunderstanding with your local friends), but not the TZ the OS uses for itself.
I find that any choice of home TZ would be arbitrary, so UTC is the best choice.
It can't be easily fixed. Imagine I continuously change the OS's setting to always reflect the local time. Now I read a log of events happened last Tuesday. Was it when I was in Europe or when I was in the US? How should I read those timestamps? Then I compare two timestamps from last spring. They differ a few minutes, but one was before the switch to DST the other was after. Which one happened first?
> you want them to be almost always wrong?
I think "wrong" is relative, isn't it?
> Well, not unless it's some workaround for flawed software
Exactly the opposite: there used to be a SO from Redmond that didn't allowed you to set its internal clock to UTC. I think it's been corrected now.
Traveling.
Yes but the body in the parameters really is a show stopper. What if the body has a unprotected comma? Like
VecForeach(&v, e, {
int x, y;
...
});
Better to expand the macro into one or two "for" and let the body follow. For example: #define VecForeachIdx(v, var, idx)\
for (size idx=0,_d=1; ValidateVec(v),_d; _d--)\
for (VEC_DATATYPE(v) var={}; idx<(v)->length && (var=VecAt(v,idx),1); idx++)
Please note that I haven't tested it.I'd say "mostly C11": it uses __VA_OPT__ that's been standardized only in C23.
The "foreach" macros need a lot of refinement: passing the body in the parameters is asking for troubles, for example. And using a non-unique default name for the index prevents nested loops.
To overcome the issues with generic and qualified types, have you considered using typeof_unqual?
_Generic(*(typeof_unqual(x)*)0, ...)