Re: Question about GTK+ and timers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 8 Apr 2011 15:43:17 -0700
Igor Korot <ikorot01@xxxxxxxxx> wrote:
> Paul,
> 
> On Fri, Apr 8, 2011 at 3:28 PM, Paul Davis
> <paul@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, Apr 8, 2011 at 6:14 PM, Igor Korot <ikorot01@xxxxxxxxx>
> > wrote:
> >> Mikhail,
> >>
> >> On Fri, Apr 8, 2011 at 2:33 PM, Mikhail Titov <mlt@xxxxxx> wrote:
> >>> As far as I understand it is possible to use it with NULL for
> >>> encoding. It should just read bytes with no interpretation.
> >>>
> >>> http://www.mail-archive.com/gtk-list@xxxxxxxxx/msg29589.html
> >>>
> >>> Mikhail
> >>
> >> I understand this.
> >> However, what I want is to read data in:
> >>
> >> struct Data
> >> {
> >> Â Â Âchar m_header[2];
> >> Â Â Âchar m_code;
> >> Â Â Âchar m_voltageMask[2];
> >> Â Â char m_highestVoltage[2];
> >> Â Â char m_lowestVoltage[2];
> >> Â Â char m_status;
> >> } m_data;
> >>
> >> I need to look at voltageMask, highestVoltage and lowestVoltage
> >> initially. Is it possible to use m_data with GIOChannel?
> >
> > of course.
> >
> > but you'd better hope that the compiler packs that data structure in
> > the same way the device is sending it. you'd be far better off not
> > using a struct for this, but just reading (in your case) 10 bytes.
> >
> > sending raw C structs over any kind of "wire protocol" almost always
> > turns out to be huge mistake unless its been very carefully thought
> > about.
> 
> 
> So best way is to use char m_data[10]?

Why do you have this idea you need to use an aggregate, which then
causes packing and layout issues to arise, leading to non-portability.
Why not send them as individual entities, since you are guaranteed that
they will be serialised? (I am not saying that you don't have a reason,
but you have not given it.)

Chris



_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux