Using typedef variables

Hello,

I need an advice.

I have a package with my user defined type:

package types_def;

typedef enum { SRC = 0,
DST = 1 } kind_e;

endpackage: types_def

I want to use that type in driver, for instance. What is the proper practice to do this?

I found out two ways to do this. First one using types_def:: before SRC or DST in driver. And the second one to put “import types_def::*;” string in driver code, so it excludes need to use “types_def::” every time with SRC or DST variables.

In reply to Danil:

There isn’t a recommended practice, so either one will work. I typically see the package imported so that the user doesn’t have to add the scoping prefix. However, be aware that if multiple packages declare the same typedef, you will have namespace conflicts and will be forced to add the scoping prefix.

In reply to cgales:

Thank you for your help cgales