Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-09

How do you test for set membership?

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frank Church

I have this code:

type
    dbgOptions = (dbgAMI, dbgRemoteLinks);
var
  dbgActiveOptions: set of dbgOptions;
procedure SetupDefaultvars;
begin
  dbgActiveOptions := [];
end;
Running the code below produces this error message:
rcacsbilling.pas(3660,25) Error: Identifier not found "dbgRemoteLinks"
      if [dbgRemoteLinks] in dbgActiveOptions then
        mmoURLPageContent.Lines.AddStrings(procList);

Is that the wrong syntax in FreePascal?

Frank Church ======================= http://devblog.brahmancreations.com
Jonas Maebe
to Frank Church
Frank Church wrote 7 lines
Running the code below produces this error message: rcacsbilling.pas(3660,25) Error: Identifier not found "dbgRemoteLinks" if [dbgRemoteLinks] in dbgActiveOptions then mmoURLPageContent.Lines.AddStrings(procList); Is that the wrong syntax in FreePascal?
The syntax is wrong, but it should give a different error message. "in" expects a set *element* on the left hand side, why you are using a set. It should read:
  if dbgRemoteLinks in dbgActiveOptions then

Even then, I'm not sure whether that will make it compilable if the compiler really cannot find the dbgRemoteLinks identifier. Did you include the unit that defines it in the uses clauses?

Jonas

Frank Church
to Jonas Maebe: The syntax is wrong, but it should give a different error message. "in" expects a set…
Jonas Maebe wrote 21 lines
On 05 Sep 2010, at 15:05, Frank Church wrote: > Running the code below produces this error message: > rcacsbilling.pas(3660,25) Error: Identifier not found "dbgRemoteLinks" > > if [dbgRemoteLinks] in dbgActiveOptions then > mmoURLPageContent.Lines.AddStrings(procList); > > Is that the wrong syntax in FreePascal? The syntax is wrong, but it should give a different error message. "in" expects a set *element* on the left hand side, why you are using a set. It should read: if dbgRemoteLinks in dbgActiveOptions then Even then, I'm not sure whether that will make it compilable if the compiler really cannot find the dbgRemoteLinks identifier. Did you include the unit that defines it in the uses clauses?

My error. dbgRemoteLinks was in a separate types unit and I hadn't included it yet.

Thanks

Show quoted text 5 lines
Jonas_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Frank Church ======================= http://devblog.brahmancreations.com