Playback speed
×
Share post
Share post at current time
0:00
/
0:00

Paid episode

The full episode is only available to paid subscribers of Computer, Enhance!

Q&A #56 (2024-06-10)

Answers to questions from the last Q&A thread.
21

In each Q&A video, I answer questions from the comments on the previous Q&A video, which can be from any part of the course.

Questions addressed in this video:

  • [02:42] “If you store non null terminated strings, I assume you have some function like c_str() for converting it when you need it for something which requires the null termination. But if you do not null terminate the string, do you then need your c_str but function to take a buffer to write it in to, or, how do you handle that effectively? I assume there might not be much to do about it really?”

  • [07:12] “You also say that taking sub strings you just use a pointer to the same memory and a length. That is essentially a string view. So do you mean that you make a string view class too and the actual string class works roughly the same? Or how do you handle that? Because holding a non owning pointer to separate memory vs having the memory as part of the object is quite different. So I assume you are not treating those to cases indistinguishably right? But likely the string can implicitly convert to string view cheaply.”

  • [13:06] “I know that you probably haven't looked in a long time but If I want to learn some windows APIs to be able to write all my programs in C instead of C#, Is windows via C/C++ still the best resource available? Do you have any suggestion other than trying to find tutorials on creating windows and message pumping and looking at MSDN?”

  • [14:20] “I swear for the life of me, i can't manage to link the sim86 decoder you provide with my c code on lesson https://www.computerenhance.com/p/using-the-reference-decoder-as-a

    I'm on linux, all my helpers functions are on c and won't work if I compile with clang++”

  • [16:16] “Do you have any idea why malloc() would think that's OK to return unaligned memory?”

  • [19:10] “Regarding the non-temporal stores, I really wonder what happens if you use non-temporal stores to write 4 bytes for example (such as movnti m32, r32), or 8 bytes (movnti m64, r64)”

  • [21:39] “Can you explain the Entity Component System (ECS) pattern in games and whether you think it is a good approach? Is there a better alternative?”

  • [26:47] “Hi, I'm getting very unexpected results for listing 153, 155 and 158. After the tests have been running for around 5 minutes the speed suddenly stabilizes to semi-L1 speeds.”

  • [32:26] “You mentioned some offset bits (index inside a cache line), some set bits (to find the matching set) and some tag bits (to find the actual matching cache line inside of a matching set). All these bits belong to a memory address that we try to read from or write to, but what does a memory address mean in this context? Is it a virtual memory or a physical memory address? If it is a virtual memory, does it mean that it has 2 different schemes (a 4-level paging scheme and a tag-set-offset scheme)? Are these schemes completely independent from each other? Or, if it is a physical address, when does the CPU get this address? When we traverse through 4-level pages and finally find the exact memory address inside the RAM?”

  • [52:12] “Does jitted code compare to performances of AOT compiled code?”

  • [1:00:18] “I'm a total beginner in C and my question is are global variables something to avoid in general?”

  • [1:07:25] “Can you talk about bit more about what happens when a core switches threads? Like the pipelined instructions on the CPU where it may have something like 5 of the same operations pipelined for 1 thread, what happens during the switch?”

The full video is for paid subscribers

Programming Courses
A series of courses on programming topics.