Prof A Olowofoyeku (The African Chief) wrote:
On 20 Dec 2002 at 7:22, Frank Heckenbach wrote:
[...]
An alternate syntax could be applied to any type -- though I wonder, what, e.g., `Byte (32)' should mean. ;-) The only possibly reasonable explanation would be the same as `Cardinal (32)'. Though C doesn't allow `char foo : 32' if the size of `char' is smaller than 32 bits.
As for the syntax, my suggestion was:
TypeOfSize (Integer, n)
Waldek suggested:
type foo = Integer attribute(Size(n),...);
I tend to prefer Waldek's (maybe even `attribute (packed (n))' since there is already a `packed' attribute in GCC, but without argument). The advantage is to avoid introducing a special identifier.
If a function returns "foo" and "foo is declared as "Integer attribute(Size(n),...)" doesn't this trigger the age-old problem with functions and attributes (that means you have to declare the function twice)? And, assuming that the function itself needs another attribute (e.g., stdcall)? Then will there be a problem? - e.g. "function bar (i :foo): foo; attribute(stdcall);"
I wrote: : However, I think this should only apply to `type' definitions then : (I think the same holds for GCC's `packed' attribute), not to `var' : declarations etc. where it would implicitly create a new type.
Also, since this will require new extensions to the compiler anyway, I would have thought that introducing an appropriately titled identifier might be preferable to extending an existing identifier.
But `attribute' is already a "container" ... Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: 51FF C1F0 1A77 C6C2 4482 4DDC 117A 9773 7F88 1707