[AVR-GCC] uczulenie na warning ...

Witam kompilator wywala mi taki blad: "warning: passing arg 2 of `send_data' discards qualifiers from pointer target type"

prototyp: void send_data (FILE *__stream, void *data, size_t len, uint8_t type)

wywolanie: send_data (&rs232, &Sockets, sizeof(Sockets), 0x01)

zmienna: static volatile uint16_t Sockets;

dlaczeo wywala ten blad? moze mi ktos wyjasnic?

podrawiam: Pawel K

Reply to
Pawel K
Loading thread data ...

Thus wrote Pawel K snipped-for-privacy@kpw.qs.pl>:

A jakiego typu jest rs232?

Paweł

Reply to
Paweł Więcek

Pawel K napisał(a):

Jakiego typu jest Sockets? Najprawdopodobniej chodzi mu o niejawne rzutowanie Sockets na void*.

Spróbuj napisać: send_data(&rs232, (void*)&Sockets, sizeof(Sockets), 0x01)

Reply to
Virus_7

Paweł Więcek napisał(a):

chodzi tu o 2gi argument ...

pozdrawiam Pawel K

Reply to
Pawel K

Virus_7 napisał(a):

to na kiego grzyba jest ten void ?? wiadomo ze w f-cji i tak nadaje typ wskaznika. Pozatym chyba wiem w czym rzec ... jak deklaruje Sockets bez volatile to nie ma ostrzezenia ...

pozdrawiam Pawel K

Reply to
Pawel K

Pawel K przemówił ludzkim głosem:

Sam sobie odpowiedziałeś na pytanie. Funkcja send_data nie gwarantuje, że Socket zostanie potraktowany jako wskaźnik na dane typu volatile i kompilator przed tym ostrzega.

Reply to
Zbych

Ale data+1 to nie bedzie to samo co &Socket+1

Aaa, to chodzi mu o usuniecie volatile.

majac fukcje void send_data (FILE *__stream, void *data, size_t len, uint8_t type)

kompilator nic nie wie ze ma kompilowac tak jakby *data moglo sie w kazdej chwili zmienic.

sprobuj void send_data (FILE *__stream, volatile void *data, size_t len, uint8_t type)

J.

Reply to
J.F.

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.