[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Edlug Archive Mar 2004 ]

RE: [edlug] OT: Linux-Windows datastructure exchange C++



Got it ...
Thanks again for your anwser.
Paul.


To align the fields on 1-byte boundaries:

#pragma pack(1)    /* align on 1-byte boundaries */
struct Symbol
{
  enum Kind kind;
  char op;
  int ival;
  float fval;
  char id;
};
#pragma pack()     /* restore compiler's alignment setting */



On Wed, 2004-03-03 at 21:12, Tim Day wrote:
> On Wed, 2004-03-03 at 18:25, Jon Rabone wrote:
> > There are plenty of libraries to do network transport of binary data,
> > pick one based on its merits for your application and use it. Rolling
> > your own is rarely justifiable.
> 
> Certainly as a minimum anything transported should be translated through
> something like htonl/ntohl or the xdr_* routines.
> 
> > Because if he had to ask a question like that, he clearly doesn't know what
> > he's doing and should be using a standard tool, rather than kludging low
> > level network transport code together which undoubtedly will fail to be
> > safe, architecture-independent, reliable and reusable.
> 
> Hmmm.. all I saw was someone who must have been reasonably familiar with
> gcc asking for some msdev help.
> 
> We need some more data here...
> 
> Paul: can you tell us anything about your application so we can debate
> the right tool for the job some more ?  Why are you using UDP rather
> than TCP, for example ?

-
----------------------------------------------------------------------
You can find the EdLUG mailing list FAQ list at:
http://www.edlug.org.uk/list_faq.html



This archive is kept by wibble@morpheux.org.DONTSPAMME
homepage