[fpc-pascal] Windows Type LPARAM, WPARAM

Urbansound urbansound at sbcglobal.net
Fri Sep 2 15:57:42 CEST 2005


Please ignore this.  FPC has generated this as an error.  This is an old discussion from August
  ----- Original Message ----- 
  From: Urbansound 
  To: fpc-pascal at lists.freepascal.org 
  Sent: Tuesday, August 16, 2005 9:25 PM
  Subject: [fpc-pascal] Windows Type LPARAM, WPARAM


  Hi,

  I've been working with FPC 2.0.0 and Dev-Pas for some GUI efforts and another programmer pointed out an interesting thing, regarding the LPARAM and WPARAM types.  I hope I'm not kicking up old dust, but for the sake of clarification if we may...

  The Microsoft architecture affiliates these two keywords as "Types", based upon case sensitivity, among the variouse usage they apply from a C perspectieve, where in Pascal, case is insensitive.   In Dev-Pas' gui template, they assign these same words as follows... 

  //--------- 
  function WindowProc(Window: HWnd; AMessage, WParam,
            LParam: Longint): Longint; stdcall; export;

  LParam becomes Longint, but it is a TYPE actually.

  Without case sensitivity in Pascal, these same words can become declared variables as above, which leads to ambiguous code.


  //----------
  Consider the useage otherwise as ...

  function WindowProc(Window: HWnd; AMessage: UINT; WParam : WPARAM;
                      LParam: LPARAM): LRESULT; stdcall; export;

  In hopes of avoiding a discussion on the merits of case-sensitivity in compiler design...  Is there any way to switch on case sensitivity or otherwise a switch to have references become reserved words, such that their case insensitive nature can be raised as an error in the above cases?  LPARAM AND WPARAM are consistently present in most windows usage.

  i.e.    LParam: Longint     >    would raise an error for reserved word.
           LParam:LPARAM    >    would raise an error as a redundant cast

          xxx:Lparm would cast xxx to any case manner of Lparam/Wparam
          
  I suppose that there are a number of cased words in Windows that make the consideration impractical overall,  but is this strictly a manner of managment on the programmers behalf, to watch declarations and scope closely, or could it ever be managed as a switched option?

  Thanks in advance,

  Mike


------------------------------------------------------------------------------


  _______________________________________________
  fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20050902/2e1058a5/attachment.html>


More information about the fpc-pascal mailing list