Есть libpq, там есть объявление:
/* PGresult encapsulates the result of a query (or more precisely, of a single
* SQL command --- a query string given to PQsendQuery can contain multiple
* commands and thus return multiple PGresult objects).
* The contents of this struct are not supposed to be known to applications.
*/
typedef struct pg_result PGresult;
Как правильно нужно использовать PGresult в опережающем объявлении (чтобы не тянуть заголовок libpq в .h файл)
struct pg_result; // собственно само опережающее объявление
typedef struct pg_result PGresult; // воссоздание типа PGresult
Как я понимаю это будет правильный вариант опережающего объявления, но нет ли тут каких-либо подводных камней?
Нужно использовать также, как в libpq
Есть libpq, там есть объявление:
/* PGresult encapsulates the result of a query (or more precisely, of a single
* SQL command --- a query string given to PQsendQuery can contain multiple
* commands and thus return multiple PGresult objects).
* The contents of this struct are not supposed to be known to applications.
*/
typedef struct pg_result PGresult;
Опережающее объявление сократит время сборки, так как компилятор не будет разбирать большие заголовки, следовательно компиляция может ускорится очень сильно.
Сборка персонального компьютера от Artline: умный выбор для современных пользователей