# Bad recognizing of structs size ??

**URL:** <https://forums.digi.com/t/bad-recognizing-of-structs-size/11820>\
**Category:** Rabbit Software\
**Tags:** error, far, compiler\
**Created:** [August 6, 2013, 5:36am UTC](https://forums.digi.com/t/bad-recognizing-of-structs-size/11820 "2013-08-06T05:36:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FabioPD](https://avatars.discourse-cdn.com/v4/letter/f/8baadc/32.png) [@FabioPD](https://forums.digi.com/u/FabioPD)\
**Post date:** [August 6, 2013, 5:36am UTC](https://forums.digi.com/t/bad-recognizing-of-structs-size/11820/1 "2013-08-06T05:36:08Z")

</div>

Using the DC 10.70 (and 10.72) I notice this problem to compiling targetless (my board is RCM4310) :

The compilation doesn’t ends and no error is detected! (error window is empty and the map file is incomplete!)

this is the code:

typedef struct {  
byte a[100];  
} str1;  
bbram far str1 mystr1;

typedef struct {  
uint16 x;  
uint16 y;  
str1 z[400];  
} str2;  
bbram far str2 mystr2;

#define array\_size sizeof(mystr2) // number of bytes in array

main () {  
printf("  
“);  
//printf(”%d", array\_size);  
printf("  
");  
}

map file:

// Function mapping and source reference.  
// \* The size of labels is indeterminate and so is denoted with an asterisk.  
// Addr Size Function File Line Num

// Global/static data symbol mapping and source reference.  
// Addr Size Symbol File Line Num Type  
b3c3 4 dkSendChar \DKCORE.LIB 2605 struct \_\_dksendchar  
b3b7 12 sxd \RS232.LIB 479 struct \_sxd \*[]  
00f9:ef9c 100 mystr1 \UNTITLED1.C 4 \_\_far struct mystr1

// Parameter and local auto symbol mapping and source reference.  
//Offset Rel. to Size Symbol File Line Num Type

// Macro listing and source reference.  
// Name File Line Num  
_RESTRICT\_WATCHCODE_  
SETUSERMODE \DEFAULT.H 14  
SETSYSMODE \DEFAULT.H 15  
\_system \DEFAULT.H 16  
\_SYS\_CALL\_VARS \DEFAULT.H 17  
…

[bgcolor=blue]Anydody can explain me what’is happening??[/bgcolor]

---

<div class="post-metadata">

**Author:** ![petermcs](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@petermcs](https://forums.digi.com/u/petermcs)\
**Post date:** [August 6, 2013, 7:29am UTC](https://forums.digi.com/t/bad-recognizing-of-structs-size/11820/2 "2013-08-06T07:29:57Z")

</div>

The limit on the size of a struct is 32K and your str2 is 40004 bytes in size. The compiler seems to not give an error message for this and just stops. If you reduce the [400] in your example to 100 for example the code compiles correctly.

Regards,  
Peter

---

<div class="post-metadata">

**Author:** ![FabioPD](https://avatars.discourse-cdn.com/v4/letter/f/8baadc/32.png) [@FabioPD](https://forums.digi.com/u/FabioPD)\
**Post date:** [August 6, 2013, 10:16am UTC](https://forums.digi.com/t/bad-recognizing-of-structs-size/11820/3 "2013-08-06T10:16:27Z")

</div>

Thanks petermcs  
I’m cheer up that is only a compile problem of sizeof() function and now I can continue with my big structs but I prefer have an compiler error…

I Imagine that if I use the last bytes of mystr2 the pointer can overwrite unknow mem areas…

How can I reprot this heavy bug to Idigi developers?

---

<div class="post-metadata">

**Author:** ![petermcs](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@petermcs](https://forums.digi.com/u/petermcs)\
**Post date:** [August 7, 2013, 2:15am UTC](https://forums.digi.com/t/bad-recognizing-of-structs-size/11820/4 "2013-08-07T02:15:28Z")

</div>

You can do it at [http://www.digi.com/login?ReturnUrl=%2Fsupport%2Feservice%2F](http://www.digi.com/login?ReturnUrl=%2fsupport%2feservice%2f) or you can probably send an email to [support@digi.com](mailto:support@digi.com)
