Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference of the following snippets

Tags:

c++

c

Please tell me what is the difference of

typedef struct Tcl_ObjType {
    char *name;
    Tcl_FreeInternalRepProc *freeIntRepProc;
    Tcl_DupInternalRepProc *dupIntRepProc;
    Tcl_UpdateStringProc *updateStringProc;
    Tcl_SetFromAnyProc *setFromAnyProc;
} Tcl_ObjType;

and

struct Tcl_ObjType {
    char *name;
    Tcl_FreeInternalRepProc *freeIntRepProc;
    Tcl_DupInternalRepProc *dupIntRepProc;
    Tcl_UpdateStringProc *updateStringProc;
    Tcl_SetFromAnyProc *setFromAnyProc;
};

I have see the first version here: http://www.tcl.tk/man/tcl8.5/TclLib/ObjectType.htm , and don't know why it is written as it is.

like image 371
Narek Avatar asked Dec 27 '22 02:12

Narek


1 Answers

For C++, there is no difference.

If this was a C program and you used the first variant, you could do:

Tcl_ObjType instanceOfStructure;

instead of

struct Tcl_ObjType instanceOfStructure;
like image 114
Luchian Grigore Avatar answered Jan 05 '23 18:01

Luchian Grigore