Thread: a strange line of code

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    76

    a strange line of code

    I am using some code which has the following lines in it:

    Code:
    		if (struct2->hwnd == ???)
    		{
    			return -1;
    		}
    mingw gives a warning (not even an error) about trigraphs, but i dont know what that means. Can anybody give some info on the meaning of "== ???", and how i can replace it?

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    7
    the code is trying to compare the value of struct2->hwnd to ???, and if they are equal, then return -1.

    my guess is that ??? was intended to be replaced by something down the line and whomever coded it put it in as a place holder and didn't fix it. You will have to contact the author of the code, or edit it yourself.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    What other variables of the type struct2->hwnd are in scope? It might refer to one of those.

    That is an invalid line of code as is.

    Trigraph translation:
    Code:
    ??= #
    ??> }
    ??< {
    ??! |
    They're for computers that don't support #'s and stuff. You just put ??= in.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Also related are digraphs:
    Code:
    <: [
    :> ]
    <% {
    %> }
    There are more digraphs and trigraphs, but those are the only ones I've memorized.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    I have seen the trigraphs on msdn and ??? is not defined there.

    the file where this code is from is vstgui.cpp

    Code:
    LRESULT CALLBACK MouseProc (int nCode, WPARAM wParam, LPARAM lParam)
    {
    	if (nCode < 0)
    		return CallNextHookEx (MouseHook, nCode, wParam, lParam);
    
    	if (wParam == 522)
    	{
    		MOUSEHOOKSTRUCT* struct2 = (MOUSEHOOKSTRUCT*) lParam;
    		if (struct2->hwnd == ???)
    		{
    			return -1;
    		}
    	}
    	return CallNextHookEx (MouseHook, nCode, wParam, lParam);
    }
    Since this is pretty official stuff i cant believe the programmer just forgot to fill it.
    Last edited by johny145; 08-30-2005 at 03:39 PM.

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    It is MSDN afterall.....

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Can you post the actual URL of where the code came from?
    It looks like an HTML/Browser problem with generating the page, or perhaps a problem copying some fancy HTML character back to ASCII in your code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    sure i can post it, but i dont think it is a mistake with copy+past
    http://ygrabit.steinberg.de/users/yg...mon/vstgui.cpp

  9. #9
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    The line in question is inside a conditional section. I think it is incomplete code. Have you tried downloading the SDK containing vstgui.cpp? Anyway, the aim of the code in question is to prevent the WM_MOUSEWHEEL notification reaching a specific window. So, as a quick fix, you can just comment it out and not use your mouse wheel.

  10. #10
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    After my initial trials using the code i found out this line of code is the least of my problems. The documentation for the usage of vst's is incomplete and incoherent at best. I am using msdn for some time now, and although i sometimes have problems finding the info i need, the documentation from steinberg isnt even remotely as good as msdn. After a couple of hours of frustrated trials i decided to let this rest for a while until i find the time and courage to start with it again.

    The good thing about this all is that i appreciate msdn a lot more then before .

    And thx to all who have replied in this thread .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A simple but strange code of malloc()
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 03-31-2008, 04:58 AM
  2. ASM beginner gets 24 compiler errors on hello world...
    By Desolation in forum Tech Board
    Replies: 12
    Last Post: 06-16-2007, 10:21 PM
  3. What does this line of code mean?
    By diagonalArg in forum C++ Programming
    Replies: 3
    Last Post: 07-28-2005, 12:59 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM