comp.lang.ada
 help / color / mirror / Atom feed
From: awdorrin <awdorrin@gmail.com>
Subject: Re: Interfaces.C.String.Update
Date: Mon, 28 Nov 2011 08:35:37 -0800 (PST)
Date: 2011-11-28T08:35:37-08:00	[thread overview]
Message-ID: <bd21de6e-0b53-4c39-9112-e4b1e003ea3e@s6g2000vbc.googlegroups.com> (raw)
In-Reply-To: b6bdc1a3-c20c-4cac-9791-07a671861f85@f29g2000yqa.googlegroups.com

Thanks for the confirmation and the suggestions.

One followup question about Update and the use of Check=>True...

If I'm understanding things properly, given the following scenario:

Character array defined in C, initialized with a memset of nulls.

Passing a char* to Ada, using the Chars_Ptr - Any attempt to use
Update with Check=>True will raise an Update_Error, because Ada will
see the string pointed to as zero length, right?

So this requires us to disable the check and do some checking on both
sides to make sure that we don't blow the char buffers.

I think, updating these functions to pass in the buffer length (or
'cheating' by initializing the char arrays with spaces instead of
nulls) would be safer, and allow me to take advantage of the
Check=>True functionality.




  reply	other threads:[~2011-11-28 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28 15:55 Interfaces.C.String.Update awdorrin
2011-11-28 16:09 ` Interfaces.C.String.Update Adam Beneschan
2011-11-28 16:22 ` Interfaces.C.String.Update Ludovic Brenta
2011-11-28 16:35   ` awdorrin [this message]
2011-11-28 17:37     ` Interfaces.C.String.Update Ludovic Brenta
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox