Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 23rd, 2005, 04:27 PM
steve6341 steve6341 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 51 steve6341 User rank is Corporal (100 - 500 Reputation Level)steve6341 User rank is Corporal (100 - 500 Reputation Level)steve6341 User rank is Corporal (100 - 500 Reputation Level)steve6341 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 8 h 59 m 29 sec
Reputation Power: 6
Passing Class Parameters??

I have this line of code that I am using in C++
Code:
CreateMachineID(TEsMachineInfoSet() << midUser); 

As I understand I am passing class parameters to CreateMachineID method. I want to know how to use this line of code in Delphi. Simply replacing "<<" with "shl" does not work. As usual, I appreciate any help anyone can give me. Thanks.

Reply With Quote
  #2  
Old December 26th, 2005, 09:29 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Israel
Posts: 217 Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Day 11 h 56 m 39 sec
Reputation Power: 15
the "<<" in C++ is the Shift Left operator. its Delphi equivalent is the function Shl...
as long as "TEsMachineInfoSet" and "midUser" are both numeric, there's no reason
why it won't work. so, what you mean by "does not work"?
you get error on compile? during run time? nothing happens? the computer freeze?
please give more details.

Reply With Quote
  #3  
Old December 26th, 2005, 11:15 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Click here for more information.
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,713 Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 11 h 21 m 11 sec
Reputation Power: 1179
Quote:
Originally Posted by Shadow Wizard
the "<<" in C++ is the Shift Left operator. its Delphi equivalent is the function Shl...
as long as "TEsMachineInfoSet" and "midUser" are both numeric, there's no reason
why it won't work. so, what you mean by "does not work"?
you get error on compile? during run time? nothing happens? the computer freeze?
please give more details.

Close, but not quite correct in the context of C++ Builder. You're quite correct that << is normally the C++ bit shift left operator, but don't forget that operators can be overloaded (for instance, cout << "foo" prints a string, since << is overloaded for the cout object). When there is a set of flags to be passed to a function, C++ Builder tends to overload << as a setflag function. Thus TEsMachineInfoSet() << midUser is passing a TEsMachineInfoSet() set object and setting the midUser member for this set object before passing it to the function. The Delphi equivalent of a set is to place it within [ and ].
Code:
CreateMachineID([midUser]); 

If you had two flags to set, the C++ Builder version would look like this:
Code:
SomeFunc(TSomeSetObject() << flag1 << flag2);

and the Delphi equivalent would look like this:
Code:
SomeFunc([flag1, flag2]);
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month

Reply With Quote
  #4  
Old December 27th, 2005, 02:42 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Israel
Posts: 217 Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)Shadow Wizard User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1Folding Points: 377411 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Day 11 h 56 m 39 sec
Reputation Power: 15
cool, didn't know that it exists in C++ - steve also said he tried using Shl function
thus I assumed he was trying to indeed use the shift left operator.
well, it's always good to learn some new stuff!

Reply With Quote
  #5  
Old December 27th, 2005, 06:17 PM
steve6341 steve6341 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 51 steve6341 User rank is Corporal (100 - 500 Reputation Level)steve6341 User rank is Corporal (100 - 500 Reputation Level)steve6341 User rank is Corporal (100 - 500 Reputation Level)steve6341 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 8 h 59 m 29 sec
Reputation Power: 6
Thanks a lot Scorpions! Once again you've been most helpful in solving my problem. (I appreciate your input too, Shadow Wizard). I only wish I knew enough to help with some the other questions around here.

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Passing Class Parameters??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT