source: CIVL/examples/languageFeatures/bundleStructComponent.cvl@ d410676

1.23 2.0 main test-branch
Last change on this file since d410676 was b95df30, checked in by Tim Zirkel <zirkeltk@…>, 13 years ago

Added bundle example with defect.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@187 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 332 bytes
Line 
1#include <civlc.h>
2
3typedef struct foo {
4 int a[5];
5 int b;
6} foo;
7
8void main() {
9 int c[6];
10 foo s;
11 $bundle bun;
12
13 for (int i = 0; i < 5; i++) {
14 s.a[i] = i*i;
15 }
16 s.b = 25;
17 bun = $bundle_pack(&(s.a), 6*sizeof(int)); // There may be padding, so this should fail.
18 $bundle_unpack(bun, &c);
19 $assert c[5] == 25;
20}
Note: See TracBrowser for help on using the repository browser.