Liste des Groupes | Revenir à cl c |
On 7/17/2024 6:38 AM, Bart wrote:To be clear - you are talking about debugging your compiler here, yes?On 13/07/2024 10:39, BGB wrote:I got back to debugging...
>But, as I see it, no real point in arguing this stuff (personally, I have better stuff to be doing...).>
We all do. But this group seems to be about arguing about pointless stuff and you might come here when you want a respite from proper work.
>
However (here I assume you've gone back to Quake but that other interested parties might be reading this), consider the program below.
>
Ironically, one of the big bugs I ended up finding was related to internal struct handling "leaking through" and negatively effecting stuff.How could it possibly mean anything else? Structs in C are objects - contiguous blocks of bytes interpreted by a type. Assigning them will mean copying those bytes. Pretending the language sometimes means structs and sometimes means magical auto-dereferencing pointers to structs is simply wrong.
say:
typedef struct foo_s foo_t; // don't care what it contains for now.
foo_t arr[...];
foo_t temp;
int i, j;
...
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
Internally, it would load a reference to arr[i] into temp, but then this location would get overwritten before the third assignment happened, causing the incorrect contents to be copied to arr[j].
For now, have ended up changing stuff such that any struct-assignment (for structs in the "by-ref" category) to a local variable will instead copy the contents to the memory location associated with that struct.
Les messages affichés proviennent d'usenet.