I would like to access "statically" (i.e. in compile time) given instance members of types (of course to retrieve static properties of them, not actual values or something like this).
I just discovered the following construct in our codebase (simplified in the example):There are multiple threads, one calling someLoop() while the others call setKeepGoing() and/or setDoAdditionalStuff().
The following code:Outputs:I understood that an array is another form to express a pointer, but we cannot change its address to point anywhere else after declaration. I also understood that an array has its value as the first position in memory. Therefore, 0x22ff20 in this example is the location of...
Clearly, fixed-width integral types should be used when the size is important.However, I read (Insomniac Games style guide), that "int" should be preferred for loop counters / function args / return codes / ect when the size isn't important - the rationale given was that fixed-width types can preclude certain...
I encountered code like:The datatype of bIsOk is bool, isOpen(..) returns BOOL (defined as int)The engineer told me that was said to be the most efficient way to get from BOOL to bool.
As described in std::chrono::duration::operator+= the signature isThis makes me wonder. I would assume that a duration literal can be used like any other built-in, but it doesn't.
I find myself often with code that looks like this:Seems like there ought to be better way to express this as it's a common pattern in functions that act like "join".
I read that: in C, local variables start with unknown valueand I decided to check it, that's what I did:
I wrote a function for implementing merge sort on singly linked list, where every element has an integer and a next pointer. One of the function splitlist is used to split the given linked list into two linked lists
Let's say we have generic method:And we are invoking it with the following parameters:The results are: