kerdesek

Andras Tantos andras at tantosonline.com
Wed Aug 31 20:55:59 CEST 2005


> Andras Tantos wrote:
>
>> Biztos, hogy nem az IrLMP_Ctl-el van baja? Ha az nincs deklaralva, vagy
>
> Persze. Ha atirtam utana a kovetkezo sort, ugy ahogy az elozo
> leveleimben mar irtam (tehat uint8_t *info) akkor lefordult.
> Hogy mukodik-e, meg nem tudom, nem holnap fog kiderulni :(
>
>> De az is lehet, hogy az uint8_t nincs definialva.
>
> Van, sajna, meg a masik is. Egyszeruen a 0 hosszu tombot nem
> birja az IAR. Lehet hogy mas forditok megeszik, de fogalmam sincs
> hogy mit csinalnak, mit kell ilyenkor a szabvany szerint forditaniuk.

Ez ugyan a C++ szabvany, de az ezt irja:

8.3.4 Arrays [dcl.array]

1 In a declaration T D where D has the form

D1 [constant-expression(opt)]

and the type of the identifier in the declaration T D1 is 
"derived-declarator-type-list T," then the type of the identifier of D is an 
array type. T is called the array element type; this type shall not be a 
reference type, the (possibly cv-qualified) type void, a function type or an 
abstract class type. If the constant-expression (5.19) is present, it shall 
be an integral constant expression and its value shall be greater than zero.
...
If the constant expression is omitted, the type of the identifier of D is 
"derived-declarator-type-list array of unknown bound of T," an incomplete 
object type.

Mashol meg ezt irja:

The syntax provides for empty initializer-lists, but nonetheless C++ does 
not have zero length arrays.

amikor arrol beszel, hogy mit jelent az int i[] = {1,2,3};.

Szoval feltehetoen az tortenik, hogy az IAR szerint int i[0] ugyanaz, mint 
az int i[], ami 'incomplete type'. Az mar egy masik kerdes, hogy a szabvany 
szerint az int i[0] nem legalis, az meg megint masik kerdes, hogy a Visual 
C++ (es ezek szerint a GCC is) megis megengedi. Egyebkent van egy erdekes 
megjegyzes a delete[] operator-nal a szbvanyban:

For non-zero-length arrays, this is the same as a pointer to the first 
element of the array created by that new-expression. Zerolength arrays do 
not have a first element.

Szoval, akkor megis van 0 hosszusagu tomb?

Megoldaskent ird at uint8_t info[1]-re felteve, hogy a sizeof(ctl) != 0.

Udv,
Tantos Andras




More information about the Elektro mailing list