Note that there are some explanatory texts on larger screens.

plurals
  1. PODelphi: Undefined record variable
    primarykey
    data
    text
    <p>I have defined a <code>TCGTable</code> record type with the following structure:</p> <pre><code>type TCGTable = record x : array [1 .. MAX_POINTS] of Single; y : array [1 .. MAX_POINTS] of Single; end; </code></pre> <p>I have declared a <code>TCGTable</code> variable <code>CGTable</code>. </p> <p>The variable <code>CGTable</code> is assigned a particular constant <code>TCGTable</code> record value if that record meets several runtime conditions.</p> <p>If no constant <code>TCGTable</code> record meets these conditions, <code>CGTable</code> should be undefined. </p> <p>Is there a Delphi 2010 built-in value I can assign to <code>CGTable</code> to indicate that it is undefined? I have tried using the values <code>nil</code> and <code>null</code>, but both of these seem to be valid only for pointer or variant types. The source will not compile with these values assigned to <code>CGTable</code>.</p> <p>I would like to inspect the variable <code>CGTable</code> to determine its validity instead of, for example, maintaining some additional boolean validity flag.</p> <p>The only workarounds I can determine are:</p> <p>a) Change the type of <code>CGTable</code> to a <code>TCGTable</code> pointer (<code>CGTable : ^TCGTable;</code>), which would then allow me to compare <code>CGTable</code> to the <code>nil</code> value.</p> <p>b) Define some constant <code>TCGTable</code> record to act as an "invalid" record. I would then compare <code>CGTable</code> against this "invalid" record.</p> <p>Any suggestions on how to approach this? Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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