Hi Przemek and all,

We have hb_parc()/hb_parcx()/hb_itemGetCPtr() to
return direct pointers to Harbour strings (maybe more).

I've stumbled into some C code (rddads, hbhpdf) directly
passing these buffers to C level functions _returning_
values in this buffer. This may corrupt HVM.

Such code is currently difficult to find.

Question: should we make the return value of these
functions 'const' ? (and maybe do some tricks to
stay compatible when user code is using _parc()).

Or in general: Shouldn't we make better use of
'const' flag?

Does these make any sense?

[ Few examples for possible HVM corruption, after
recompiling hbwhat32 with const flag:
GETCOMPUTERNAMEEX(), GETUSERNAME(), ACCEPT() ]

Brgds,
Viktor

PS: I know this would cause an avalanche in 'const'-ing
various other function parameters and add casting,
and I also know of hb_itemUnShareString(), and I'm not
suggesting to solve it before 1.0.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to