Thread View: pl.comp.lang.pascal
3 messages
3 total messages
Started by Mentor
Mon, 03 Dec 2007 11:36
Record... Pytanie :/
Author: Mentor
Date: Mon, 03 Dec 2007 11:36
Date: Mon, 03 Dec 2007 11:36
36 lines
1500 bytes
1500 bytes
Witam pracuje w lazarusie i c++
W c mam strukturę danych:
#define PACKED __attribute__ ((packed))
struct tcp_mysql_sent {
long id;
char net_addr;
char device;
short temp_komora;
short temp_parownik;
short nastawa;
char state;
char time[9];
char date[11];
}PACKED;
sizeof(struct tcp_mysql_sent) daje wartosc "33" zgadza się
w lazarusie mam:
type tcp_mysql_sent = record
id : integer;
net_addr : char;
device : byte;
temp_komora : smallint;
temp_parownik : smallint;
temp : smallint;
state : char;
_time : array[1..9] of char;
_date : array[1..11] of char;
end;
sizeof(tcp_mysql_sent) daje mi wartosc "36" zle i tu pytanie czemu ?
skoro ze składni rekordu wychodzi 33 ?
Pozdrawiam Mentor
Re: Record... Pytanie :/
Author: Tygrys
Date: Mon, 03 Dec 2007 12:18
Date: Mon, 03 Dec 2007 12:18
40 lines
1789 bytes
1789 bytes
Mentor pisze:
> Witam pracuje w lazarusie i c++
>
> W c mam strukturę danych:
>
> #define PACKED __attribute__ ((packed))
>
> struct tcp_mysql_sent {
> long id;
> char net_addr;
> char device;
> short temp_komora;
> short temp_parownik;
> short nastawa;
> char state;
> char time[9];
> char date[11];
> }PACKED;
>
> sizeof(struct tcp_mysql_sent) daje wartosc "33" zgadza się
>
> w lazarusie mam:
>
> type tcp_mysql_sent = record
> id : integer;
> net_addr : char;
> device : byte;
> temp_komora : smallint;
> temp_parownik : smallint;
> temp : smallint;
> state : char;
> _time : array[1..9] of char;
> _date : array[1..11] of char;
> end;
> sizeof(tcp_mysql_sent) daje mi wartosc "36" zle i tu pytanie czemu ?
> skoro ze składni rekordu wychodzi 33 ?
Spróbuj = packed record;
Tygrys
Re: Record... Pytanie :/
Author: Wiktor S.
Date: Mon, 03 Dec 2007 15:18
Date: Mon, 03 Dec 2007 15:18
8 lines
1046 bytes
1046 bytes
> sizeof(tcp_mysql_sent) daje mi wartosc "36" zle i tu pytanie czemu ? > skoro ze składni rekordu wychodzi 33 ? wcale nie wychodzi. w c++ podałeś "PACKED" a w pascalu nie. -- Azarien
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads