Note that there are some explanatory texts on larger screens.

plurals
  1. POpart names of variable declaration
    text
    copied!<p>I am trying to extract debug information from a compiled C program with C#, and need to store the global variables.</p> <p>If I have the variable:</p> <pre><code>const unsigned char * volatile MyVariable; </code></pre> <p>the name of the variable will be <strong>MyVariable</strong>, and the type is <strong>unsigned char</strong>. what will be <strong>const</strong> and <strong>volatile</strong>. Are they part of the type? </p> <p>I have to represent a variable with a class and I am lost on how to construct it. This is how I have represented it right now:</p> <pre><code>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 } </code></pre> <p>Should I make <code>volatile</code> and <code>const</code> part of the type? What are they? Attributes?</p> <h2>Edit</h2> <p>Sorry I think I did not explained my self correctly. <strong>my question should have been how should I construct MyVariable class</strong> I know what the const keyword does to a variable and also the volatile. I use the volatile keyword when I create a variable that will be accessed by multiple threads for example. </p> <p>Anyways so based on the answers I should be constructing my class as:</p> <pre><code>public class MyVariable { public string Name; public string Type; public string[] TypeQualifiers; public int Size; // in bytes } </code></pre> <p>where TypeQualifiers will be an array of those keywords (type qualifiers). Thanks a lot for the help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload