Can C++ headerfile include C headerfile

Hi, I'm working on a project dealing with Binary-Decision-Diagram(BDD) using CUDD, which is a package for BDD manipulation. After browsing the source code of CUDD, there are cudd.h(C version) and cuddObj.h(C++ version), I've found that the C++ headerfile cuddObj.h is including the C headerfile cudd.h.

So, I'm wondering whether I can do the project in C++ and just include the cuddObj.h.

And also wondering whether I can write like below:
1
2
if (Cudd_T(node) == mgr.bddOne()) 
....

Where Cudd_T(node) is a function defined in cudd.h, as below:
1
2
3
4
5
Cudd_T(DdNode *node)
{
    return Cudd_Regular(node)->type.kids.T;

} /* end of Cudd_T */

mgr.bddOne() defined in cuddObj.h, as below:
1
2
3
4
5
6
7
8
BDD
Cudd::bddOne() const
{
    DdNode *result = Cudd_ReadOne(p->manager);
    checkReturnValue(result);
    return BDD(p, result);

} // Cudd::bddOne 

And the declaration of BDD class is in the link below :
https://github.com/ivmai/cudd/blob/release/cplusplus/cuddObj.hh

Can anyone clarify this for me?
Thx in advance!
Last edited on
most likely you can just use the c++ wrapper. A lot of code is built from C with c++ at a higher level that makes it into OOP code.

yes you can write an if statement that compares the result of a function to something.
you can do all kinds of things that way, eg
x = function(param)->function2(otherparam).field;
or to say it another way the result of a function can be used as if it were a variable, but it only exists in the line where it was called if you do not assign it into something.
Last edited on
Topic archived. No new replies allowed.