//.............................................................................. // // This file is part of the Jancy toolkit. // // Jancy is distributed under the MIT license. // For details see accompanying license.txt file, // the public copy of which is also available at: // http://tibbo.com/downloads/archive/jancy/license.txt // //.............................................................................. // Jancy runtime uses data pointer validators for ensuring pointer safety. The // developer can also access certain information in validators. This may come // handy in certain situations. //.............................................................................. foo (char const* s) { // 'dynamic sizeof' is only applicable to fat data pointers printf ("s = '%s'; length = %d\n", s, dynamic sizeof (s) - 1); } int calcSum (int const* a) { // 'dynamic countof' is only applicable to fat data pointers size_t count = dynamic countof (a); int result = 0; for (size_t i = 0; i < count; i++) result += a [i]; return result; } //.............................................................................. // entry point int main () { printf ("main ()\n"); foo ("dynamic!"); int a [] = { 10, 20, 30 } int sum = calcSum (a); printf ("sum = %d\n", sum); return 0; } //..............................................................................