1. Is "const char * const *p;" a valid construct?
Yes.
2. How do I align a given structure, say, at 32-byte boundary?
3. Then, how do I assert that a given object is aligned, say,
at 32-byte boundary?
You don't, and you can be reasonably but not perfectly sure,
respectively.
That is, if you happen to _know_ that a certain C type must be aligned
on 32-byte boundaries, then you also know that both all actual objects
of that type are indeed so aligned, and that so is the memory you get
from malloc() (because that must be correctly aligned for any type,
including your 32-byte one).
The problem is finding a type like that, because nothing in the Standard
demands anything about the alignment of any type except that several
kinds of types must have the same alignment as closely related types
(e.g., signed and unsigned int must be identically aligned; void * has
the same requirements as char *; etc.) and that malloc() returns an
all-suitable pointer. There is nothing that either demands that a
certain type is aligned to certain boundaries, or that allows you to
find out which alignment requirements a type has.
Oh, one exception: because array members are contiguous, all types can
have no stricter alignment requirements than to sizeof(type). But since
they could also be aligned more loosely (say, to half of sizeof(type)),
this doesn't actually help you any if you really need an alignment of a
particular strictness. In particular, any object of type struct align {
char align[32]; } is not guaranteed to be aligned on a 32-byte boundary,
or indeed any boundary at all.
As for asserting the alignment of an existing object, you can try to
check that ((intptr_t)&object)%32 (or if you use C89, ((unsigned
long)&object)%32) is zero. This is not strictly required to work, since
conversion from pointers to integers is implementation-defined, but it
would not be unreasonable to assume that on all modern implementations,
this does in fact work as expected - if only because the implementor
would have to go out of his way to make it fail. So expect it to fail
quite spectacularly on the DS9K <g>, but not on any common system.
Richard