Is there a portable way to detect (programmatically) the memory page size using C or C++ code ?
Across operating systems, no.
On Linux systems:
#include long sz = sysconf (_SC_PAGESIZE);