Thread: What is int% opposed to int

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    8

    What is int% opposed to int

    I have a function I am trying to use that wants a type int%
    I have tried casting an int to int% with static_cast and safe_cast and implicit cast....no such luck....does anyone know what int% is??

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Perhaps you misread and it should be int*, i.e., a pointer to int.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    8
    Nope.....it's int%

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    digraph?!

    Soma

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by phantomotap
    digraph?!
    It does not look like any digraph can be part of a type name, or would be easily confused as part of a type name in an error message.

    koooee, post the smallest and simplest program that demonstrates the error.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Feb 2009
    Posts
    8
    I am using the USB 1208LS from Measurement Computing along with their dll MccDaq.dll for the function calls, It is probably some type they decided to make up and not give much documentation on....I have had no luck finding anything.

    The function is DOutScan(int% freq)

    trying to call MccDaq:OutScan(38000) gives an compile error saying it can't convert int to int%

    thanks for the interest

  7. #7
    Registered User
    Join Date
    Feb 2009
    Posts
    8
    so the giant smily face wasn't suppose to happen

    MccDaq: : DOutScan(int% freq)

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Oh, on a hunch I checked, and now I understand. This is not standard C++. This is C++/CLI, and the % is analogous to a reference. Consequently, the reason why you cannot call MccDaq::OutScan(38000) is obvious: the int literal 38000 is not a modifiable lvalue.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    It does not look like any digraph can be part of a type name, or would be easily confused as part of a type name in an error message.
    It has nothing whatsoever to do with names and even less to do with error messages. But you've figured it out so I don't guess it matters.

    Soma

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by phantomotap
    It has nothing whatsoever to do with names and even less to do with error messages.
    Explain. By "digraph" I assumed that you meant the alternative tokens that consist of two characters each. If you mean "digraph" more generally, then I posit that your post was not helpful at all.

    After all, if your usage has "nothing whatsoever to do with names and even less to do with error messages", then it was out of point since we are talking about a type name mentioned in an error message.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "Explain."

    The digraph and trigraph tokens are greedily parsed and may or may not be replaced by the tokens they represent in any output the compiler produces. Further, a compiler is free to produce any context it wishes in displaying such output.

    In other words, saying "does not look like any digraph can be part of a type name" is idiotic. Consider `int a<:5:>' where `a' is clearly an array of 5 integers and not just an integer.

    "then it was out of point since we are talking about a type name mentioned in an error message."

    Really? It didn't seem that way. In fact, you were the first person to mention a type error and an error message. (Actually, you were the first person to mention any sort of error.) The OP only said he had a "int%" function he wished to use and couldn't find the proper way to use it. He could have got the information from documentation, a header, IRC, or any other resource.

    Strangely enough, you had already responded with this "type name" comment before you realized/discovered that the language wasn't C++ where '%' may have actually been a type related error message instead of an unrelated error in C++--which it clearly could have been. I wonder how you managed that jump. My guess would be that you still believe the OP to be misreading his source making your snarky comments delightful.

    I figured he had come across one of the worst uses of the preprocessor and had interpreted a definition--as opposed to a declaration--as part of the interface. In that light, we wouldn't have been talking about a "type name" at all.

    Soma

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by phantomotap
    In other words, saying "does not look like any digraph can be part of a type name" is idiotic. Consider `int a<:5:>' where `a' is clearly an array of 5 integers and not just an integer.
    Not really: I was merely being inaccurate, since I did not consider your example. Can braces, # and ## be part of a type name? I have the impression that they cannot, but their alternatives would be the ones under consideration here.

    Quote Originally Posted by phantomotap
    Strangely enough, you had already responded with this "type name" comment before you realized/discovered that the language wasn't C++ where '%' may have actually been a type related error message instead of an unrelated error in C++--which it clearly could have been. I wonder how you managed that jump. My guess would be that you still believe the OP to be misreading his source making your snarky comments delightful.
    Since you already had a much better picture of what might be the problem, why didn't you just explain instead of posting a one word answer, and then making a snide remark concerning my response? I guess that that is my main beef with you here: instead of providing knowledge, you just made a remark that made it seem like you knew better all along and was just waiting for me to come along and make a poor attempt at answering the question. That may not have been your intent, but it sure felt like it to me.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  13. #13
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "Not really: I was merely being inaccurate, since I did not consider your example."

    Yea. Really. If you really wanted to say something different, that's fine, but the statement itself is still idiotic... and wrong.

    "Since you already [...] remark concerning my response?"

    I didn't have a "much better picture". If I would have had a better understanding of the issue I wouldn't have been thinking C++ at all. That was a guess. (I've seen the situation I thought of before.)

    As for my response, "snide" is what I do best, but I only treated your statement in kind.

    "I guess that that is [...] answering the question."

    You are reaching. You know full well the only times I ever provoke such a situation my guile is aimed at the questioner as I intend to embarrass them into answering the question for themselves.

    "That may not have been your intent, but it sure felt like it to me."

    LMAO

    You sincerely thought that I was sitting here patiently waiting for you to come along and embarrass yourself? 'cause everyone knows that providing a poor answer is embarrassing right?! Me? Personally? I've never felt so low as when I give a poor answer. It is my private hell.

    Seriously? Even if that's really what you thought, why would you care? I'm some redneck who can't remember a large portion of my life because I too readily remember the lives I fantasize about. I've spent the bulk of my life in a book; why would I concern you?

    That said, I do not believe that's what you thought.

    Soma

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory leak
    By aruna1 in forum C++ Programming
    Replies: 3
    Last Post: 08-17-2008, 10:28 PM
  2. Replies: 8
    Last Post: 03-10-2008, 11:57 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  5. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM