Hi, On Fri, Apr 12, 2019 at 11:16:46PM +0530, Mihir Luthra wrote: > I was constructing the trie data structure which has to be operated > from the address space mapped by mmap(2). In place of “array of next > nodes”, I am using “array of offsets”.
Sounds correct. > the void * returned from calling mmap(2), I would type cast it as my > struct type. Sounds correct as well. > When needing to write data, go to the last offset *(base + offset) and > CAS. > > I have doubts regarding “type” of offset, simply off_t or int. As here > we are mapping file memory into process address space, I m not certain > what “type” would be safe to use for offsets. off_t would be a good choice, as would be size_t (although I think they're probably aliases anyway). -- Clemens