| From: Andrew Cagney <[email protected]>

| because it gets confusing and is obscure; better to spell out:
|    const something
| where the code is being used than leave everyone wondering, for instance, 
given:
|    ip_something(something *foo, const someotherthing *bar, somethingelse 
*baz);
| which are typos and which are correct?  imnsho field_desc et.al.,
| being made typedef const struct were a massive mistake

Clearly I disagree (since I created most of them).

Why is it a mistake?  Confusing and obscure?  No use should be without
the const, so make it built-in.  The const is part of the abstraction.
The "const" is something you should not have to think about separately
at each use of the abstraction.

If I remember correctly, the C const qualifier is now idempotent so
adding a redundant one doesn't generate a compiler error.

| for struct something vs typedef something;
| kernel guidelines say don't use typedefs; we've modified that to say
| "typedef" denotes stay-out but here we're saying welcome aboard

We don't use kernel guidelines except for formatting.  This isn't
kernel code.

I don't know what you mean by "stay-out" vs. "welcome aboard".

Very very roughly, struct meant: structuring data transparently,
typedef meant: an abstraction (with varying transparency).
_______________________________________________
Swan-dev mailing list
[email protected]
https://lists.libreswan.org/mailman/listinfo/swan-dev

Reply via email to