[fpc-pascal] Windows Type LPARAM, WPARAM

Urbansound urbansound at sbcglobal.net
Wed Aug 17 03:27:03 CEST 2005


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20050817/817027bc/attachment.html>


More information about the fpc-pascal mailing list