Hallo Herr Andreas K. Foerster,

am 22. November 2017 um 15:25 schrieben Sie:

> Am Mittwoch, dem 22. Nov 2017 schrieb Tom Ehlert:

>> > Are there any documented limits for environment variables in DOS?
>> no.
>> 
>> > My implementation uses a static buffer. So the content changes with
>> > every call to getenv. This is explicitly allowed by the standard.
>> 
>> > I don't want to make the buffer too large though,
>> 
>> did you ever hear about dynamic malloc()ated memory?

> Of course, but that wouldn't work here.
> It's meant to be compatible to the standard, so that existing software
> doesn't have to be changed.

> If I would malloc each time, then existing programs would need to free
> the memory. You see, memory availability is small in the small model.
nope. you return a pointer; doesn't matter if its dynamic or static
allocated.


> The only thing that could work is realloc the same space each and
> every time. But that would be slow...
do you have even the slightest idea how much time would be spend in
the realloc portion, compared to the time spend in your code, both in
relation, and in absolut terms?

besides this, free the old memory, before allocating new memory works
as well.



as a side note: if gcc has no far pointers, its usability as a 16 bit
compiler is serious limited.



Tom


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to