On 05.02.2024 19:56, Bret Johnson wrote:

That doesn't quite make sense, since 0 is just as much of a "garbage" segment 
as any other random selector

It does! Because if you have a REGPACK as automatic object (on the stack), this likely contains random values for DS and ES. I am not that into protected mode, but I am very certain that it is a bad idea not to initialize them, because if the values are not within the limits of the GDT / LDT, this should throw a general protection fault, no matter if DS or ES are dealt with at all.

But for real mode it should not matter that much. But it is not bad to have the program crash soon as the error occurred. So my common practice is to zero this union prior to using it...

Greetings, Bernd






_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to