c# - part names of variable declaration -


i trying extract debug information compiled c program c#, , need store global variables.

if have variable:

const unsigned char * volatile myvariable; 

the name of variable myvariable, , type unsigned char. const , volatile. part of type?

i have represent variable class , lost on how construct it. how have represented right now:

public class myvariable {      public string name;      public string type;       public bool isarray;      public bool ispointer;      public bool isconstant;      public bool isvolatile;      // etc...       public int size; // in bytes } 

should make volatile , const part of type? they? attributes?

edit

sorry think did not explained self correctly. my question should have been how should construct myvariable class know const keyword variable , volatile. use volatile keyword when create variable accessed multiple threads example.

anyways based on answers should constructing class as:

public class myvariable {      public string name;      public string type;       public string[] typequalifiers;       public int size; // in bytes } 

where typequalifiers array of keywords (type qualifiers). lot help.

const , volatile both type qualifiers, although independent.

the const keyword specifies object or variable cannot changed within code.

the volatile qualifier declares data can have value changed in ways outside control or detection of compiler, preventing compiler applying optimizations on code (such storing object's value in register rather memory, may have changed).

a variable both const , volatile means guaranteed not changed in current code, not mean cannot changed externally.


edit: sidenote, unsigned type modifiers in c, signed , long.
suggest have independent type fields such issigned, isunsigned , islong in addition type (int, char, etc...).


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -