C problem...se megethos domhs

Aggelos Economopoulos aoiko at cc.ece.ntua.gr
Sun Jan 25 01:52:47 EET 2004


On Sat, 24 Jan 2004 22:18:26 +0200
"John Tsiombikas (Nuclear / the Lab)" <nuclear at siggraph.org> wrote:

> Aggelos Economopoulos wrote:
> > Gia poio logo to -fpack-struct einai pio portable apo to
> > 
> > /* FIXME: need to check for specific gcc version */
> > #ifdef _GNUC_
> > #define attr_packed	__attribute__((packed))
> > #else
> > #define attr_packed
> > #endif	/* _GNUC_ */
> > 
> 
> den eipa oti to ena einai pio portable apo to allo, anaferomouna kai
> sta dyo, ego de tha xrisimopoiousa kanena apo ta dyo (see next part).

ok, apantas ston OP legontas oti uparxei ena sxetiko option alla den
8umasai poio einai, apantaw egw oti einai to -fpack-struct kai twra
paraponiesai se *mena* oti proteinw kati unportable? 8)

> 
> > 
> >>Kai genikos anti na kaneis dump ena struct sto disko, einai poly
> >>kalyteri idea na organoseis kapos ena fileformat. opote to packing
> >ton>structs kai alla tetoia den einai kan issue.
> > 
> > 
> > To "na organoseis kapos ena fileformat" stereitai periexomenou.
> > Mhpws mporeis na to diatupwseis kalutera?
> 
> tora den katalabes ontos ti eipa i exeis oreksi gia koubenta?

nai, eimai atomo periorismenhs antilhpshs. kane mou th xarh na grafeis
mikres protasoules me apla logakia pou den proupo8etoun na skeftomai
sto idio context me sena gia na ginoun katanohtes.

> einai eleino na kaneis memory dump se arxeio, kai profanos mi
> efarmosimo se polles periptoseis (px an to structure sou exei
> pointers, dynamically allocated members klp), pio anthropini methodos
> einai na organoseis ena file structure analoga me ta dedomena sou kai
> na exeis mia synartisi pou diabazei apo to arxeio, kai mia na grafei
> sto arxeio.

apo pou na arxisw? :)

- uparxoun ena swro oxi-kai toso eleines efarmoges gia tis opoies to
  performance metraei polu perissotero apo thn maintainability/
  portability tou kwdika, p.x. filesystems, databases.

- uparxoun ena swro file formats gia ta opoia einai apolutws xazo (apo
  programmatistikh apopsh) na mhn xrhsimopoieis fixed-size structs gia
  na ta diabaseis/grapseis eite me xrhsh twn read(2)/write(2) eite me
  th xrhsh tou mmap(2), p.x. elf, net protocols. An eisai tuxeros kai
  ta format einai kaloftiagmena, den 8a xreiastei pote na ta dhlwseis
  san packed.

- an to structure pou 8eleis na grapseis sto disko exei pointers[0],
  eisai astoixeiwtos programmer[1] kai auth den einai mia periptwsh pou
  mas endiaferei. sunh8ws, to fixed-size struct einai eite embedded sto
  struct pou xrhsimopoieis in-memory eite exei arxikopoih8ei apo auto
  (p.x. pack_a_into_b(struct fixed *b, struct in_memory *a))

- etc (hdh exoume arketa na suzhthsoume mexri na bare8oume kai oi duo,
  eilikrina bariemai na sunexisw)

Aggelos

[0] kamia fora den uparxei problhma bebaia
[1] QUIZ: poios word processor fhmologeitai pws ekane kati tetoio
    (egrafe kai data pou exoun nohma mono sto runtime) sto diko tou
    native format?




More information about the Linux-greek-users mailing list