Skip to content

Typedef in C and C++ Plain Text Output Should Be Simplified #41

@sophia-gh

Description

@sophia-gh

The output for typedef definitions should be simplified. The type that the typedef identifier is an alias for should not be included for simple types like int and for complex types like struct the output should reflect this type but no other information for the complex type definition as this definition is separate. The current output includes too much information for both cases

Examples and current output:

// typedefs of simple types
typedef int Integer;
// typdefs of complex types
// with named struct
typedef struct Point {
    int x, y;
} pt;
// with anonymous struct
typedef struct {
    int v, w;
} anon_struct_typedef;
// with named enum
typedef enum Color {
    RED,
    GREEN,
    BLUE
} ColorEnum;

Current Output (the escape characters are a separate issue (#40 )):

"Integer is a int typedef in ..."
"pt is a struct Point {    int x, y;} typedef in ..."
"anon_struct_typedef is a struct {    int v, w;} typedef in ..."
"ColorEnum is a enum Color {    RED,    GREEN,    BLUE} typedef in ..."

Corrected:

"Integer is a typedef in ..."
"pt is a typedef of struct in ..."
"anon_struct_typedef is a typedef of struct in ..."
"ColorEnum is a typedef of enum in ..."

The current output for the complex types includes the type, name and body of the struct or enum that the typedef name is replacing. The correct output should be simplified to remove the name and body of the complex type and be reworded as follows:

For Simple Types:

typedef [type] typedef_name; 

The correct output should not include type information, only include that the identifier name 'typedef_name' is a typedef

"typedef_name is a typedef in ..." 

For Complex types like struct and enum:

typedef struct StructName{
    int field; 
} typedef_name;

The correct output should include the type of the complex type as well as the category of typedef for 'typedef_name'

"typedef_name is a typedef of struct in"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions