I want to do something like:
int desc = -1;
if ( DB_DBM_HSEARCH == 1 ) { desc = db->fd } else desc = db->dbm_pagf;
This is impossible because of a compiler error.
Is it possible to do something like:
#define DESC db->fd //and then
int desc = DESC;
?
Sure. Though I think this would be a more suitable way to do it using macro functions (so you can change your variable names if you need to). Assuming
DB_DBM_HSEARCHis a macro: