/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/languages/C/Core/vsa.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Variable Size Arrays
 
2
 
 
3
1. C standard allows usage of variable size arrays, but not usage of variable
 
4
size arrays embedded into the structures. 
 
5
 I thin the reason is following:
 
6
    struct {
 
7
        int a[t->size];
 
8
        int size;
 
9
    } t;
 
10
 
 
11
2. Templates can't help as well.
 
12
 
 
13
3. The vsa arrays embedded into the structures can be used with gcc as a GNU
 
14
extension. However:
 
15
    + gcc-3.3.1 (at least one from Mandrake 9.x distribution) contains a bug 
 
16
    generating invalid code (for our long defines in NAMT code) resulting in 
 
17
    invalid memory allocation.
 
18
    + gcc-3.3.6 (from Mandriva 2006 contribs) has the same bug, but occurinces 
 
19
    in more rare cirstumances.
 
20
    + gcc-2.95.3(DarkLin III) and gcc-4.0.1 (Mandriva 2006) seems to work.