comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: C Alignment/IDL structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: C Alignment/IDL structures [message #43068] Wed, 23 March 2005 08:20 Go to previous message
joey is currently offline  joey
Messages: 5
Registered: March 2005
Junior Member
Nigel Wade <nmw@ion.le.ac.uk> wrote:
>>
>> // Copy the real data
>>
>> unsigned long pos = 0;
>> unsigned char *myStructureThatLooksLikeTags = malloc
> (_totalSpaceNeeded
>> * _dataIDL.size
> ());
>> for (unsigned int i = 0; i < _dataIDL.size (); i++) {
>> memcpy (&(myStructureThatLooksLikeTags [pos]), _dataIDL [i],
>> _totalSpaceNeeded);
>> pos += _totalSpaceNeeded;
>> }
>>

> In your code you copy memory from two disimilar data structures using
> memcpy() taking no account of alignment. Your memory allocation uses the
> construct _dataIDL.size(), what is that? Since you haven't shown us the

_dataIDL is actually a C++ vector of unsigned char *'s. This group of
char * is created from a C++ map of data. The map is a tagname and data
value. Complex, isn't it? I'd like to think its elegant since I can very
simply wrap any C/C++ and interface it with IDL. However, if one of the
items in the map is a structure itself, I think it has problem.

Randall: I got your code and I am going to look at it. I appreciate the
example! I am going to try throwing a structure with a double in there
and see if I can generate the same problem I am seeing on my code.

Cheers,
Joey
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Matrix expansion performance
Next Topic: Re: MISSING_VALUE

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:10:05 PDT 2025

Total time taken to generate the page: 0.00467 seconds