|
Programming and Assembly Language Please read this Topic's rules!! |
![]() |
| LinkBack | Thread Tools | Rate Thread |
| ||||
Tricky question, it isn't a matter of the one being better than the other, since they both have their pros and cons. With C#, you can so easily make a program with a lot of fancy GUI and stuff. However, it will run slower than a similar program in C++, and the user must have the .NET framework installed. On the other hand, while C++ is faster at run time, it takes more time to make the same program, and you have a lot of things to worry about (who said pointers?). For quick programming I'd go with C# anytime. You can use platform invocation (Pinvoke) to access non-C# stuff. But what do I know, I'm mainly programming in C for embedded devices...
__________________ Last edited by Allan; 7th January, 2007 at 10:37 PM. |
| ||||
That pretty much summarizes my opinion on the issue as well Alan. But then again, I tend to like getting into the dirty stuff anyway. ![]() Last edited by Gizmo; 7th January, 2007 at 10:54 PM. |
| ||||
Quote:
Both Visual C++ and C# are Microsoft products but C# is easier. Of course I do not care for code executation time cos OcBible performs simple instructions. Only some *.dlls are hungry for CPU performance.
__________________ |
| ||||
And this is the heart of good programming; pick the right tool for the job. A programming language is nothing more than a tool. |
| ||||
I agree gizmo. For example the OcBible could written in MSDOS enviroment but this is boring for user. I forgot anything about Pascal that's why I did not program in Delphi although it is a popular tool. On the other hand as we chatted in MSN Visual C++ allows you assembly programming and Win32 API calls. Two necessary issues for next OcBible editions. Hopefully Visual C++ routines run OK under C#. ![]()
__________________ |
| ||||
Quote:
|
| ||||
I used Borland Turbo C many years ago with the Object Windows Libraries (OWL) |
| ||||
This was the previous enviroment version before *.NET. BTW I do not know any other C Windows platform except of Borland and Microsoft. If someone knows anything else let me know....
__________________ Last edited by MrSeanKon; 15th January, 2007 at 10:42 AM. |
| ||||
While @ it don't forget your Vitamin C dose ![]() |
| ||||
Nevermind, just a poor joke ![]() |
| ||||
No sweat Chris, poor jokes are the only one I can afford to get! ":O}
__________________ "Though all men live in ignorance before mystery, they need not live in darkness... Justice is foundation and Mercy ETERNAL." DKE "All that we do is touched by Ocean Yet we remain on the shore of what we know." Richard Wilbur [img]/forum/attachments/random-nonsense/16515-sigs-dan_drag.jpg[/img] Subscribers! Ask Pitch about a Custom Sig Graphic |
| ||||
Quote:
Continued.... gizmo I would like your opinion about Visual C++ vs. C# The first platform is more complex IMHO but offers more capabilities e.g. Win32 API access. For example which source code runs faster? WMI commands using C# or Visual C++ and Win32 API? ![]()
__________________ |
| ||||
Chill out, thats what Chrisbard is here for ![]()
__________________ AM2 X2 4000 2GB DDR2 NVIDIA 6150 ONBOARD! Join our F@H team today.. http://www.team45.info/ Are you a subscriber? No? well then, why not.... Subscribe to AOA for a better experience and faster downloads! How to unlock and overclock your Nvidia 6800 BIOS Volt-mod your 7800gt ![]() |
| ||||
Quote:
C++ and Win32 C# and Win32 C++ and WMI C# and WMI The performance penalties associated with C# and WMI can be pretty severe. C# itself introduces roughly a 15% performance hit, in my experience. WMI can be accessed through a COM interface which is normally fairly efficient, but when coupled with C#'s marshalling code you take another 10%-15% performance hit. C# to Win32 is even worse, because you have to write custom marshaling code or use the Microsoft.Interop stuff, or use PInvoke to access it. In my experience, there is typically about a 25% overhead in doing any of that. C++ to WMI is pretty efficient. C++ to Win32 will be probably 5%-10% more efficient than WMI, but brings with it a lot of baggage. WMI aggregates a lot of interfaces and information that are scattered throughout the Win32 API (and even some protected CPU instructions), and which also vary across operating system versions from Win95 to Win98 to WinMe to WinNT to Win2K to WinXP to Vista, into a single easy-to-use API. To be fair, there are some variations of the WMI implementation across the various OSen, but those issues are documented. In addition, WMI isn't installed on 9x or WindowsNT 4, but you can download it from MS and install it on those machines. |
| ||||
Interesting information gizmo. BTW System Reporter needs assembly parts (if we extend the program for more monitoring options) thus we must convert its source code? ![]() P.S. You should edit your post (remove the uneccesary parts --> smile) ![]() The C# code does not use any external *.dll Code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Management; namespace WindowsApplication1 { public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Label label1; private System.ComponentModel.IContainer components; public Form1() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); this.timer1.Enabled = true; this.timer1.Interval = 1; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(161))); this.label1.Location = new System.Drawing.Point(16, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(42, 18); this.label1.TabIndex = 0; this.label1.Text = "label1"; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(74, 48); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; this.Text = "C#"; this.TopMost = true; this.ResumeLayout(false); } #endregion [STAThread] static void Main() { Application.Run(new Form1()); } private void timer1_Tick(object sender, System.EventArgs e) { ManagementObjectSearcher query; ManagementObjectCollection queryCollection; System.Management.ObjectQuery oq; oq = new System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem"); query = new ManagementObjectSearcher(oq); queryCollection = query.Get(); foreach (ManagementObject mo in queryCollection) { double free_RAM=double.Parse(mo["FreePhysicalMemory"].ToString())/1024; label1.Text=free_RAM.ToString(); } } } }
__________________ Last edited by MrSeanKon; 5th February, 2007 at 09:31 AM. |
| ||||
The Visual C++ code is: Code: #pragma once namespace WindowsApplication2 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public __gc class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); } protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: System::Windows::Forms::Label * label1; private: System::Windows::Forms::Timer * timer1; private: System::ComponentModel::IContainer * components; private:void InitializeComponent(void) { this->components = new System::ComponentModel::Container(); this->label1 = new System::Windows::Forms::Label(); this->timer1 = new System::Windows::Forms::Timer(this->components); this->SuspendLayout(); this->label1->AutoSize = true; this->label1->Font = new System::Drawing::Font(S"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)161); this->label1->Location = System::Drawing::Point(16, 16); this->label1->Name = S"label1"; this->label1->Size = System::Drawing::Size(42, 18); this->label1->TabIndex = 0; this->label1->Text = S"label1"; this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter; this->timer1->Enabled = true; this->timer1->Interval = 1; this->timer1->Tick += new System::EventHandler(this, timer1_Tick); this->AutoScaleBaseSize = System::Drawing::Size(5, 13); this->ClientSize = System::Drawing::Size(74, 46); this->Controls->Add(this->label1); this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; this->MaximizeBox = false; this->MinimizeBox = false; this->Name = S"Form1"; this->Text = S"C++"; this->TopMost = true; this->ResumeLayout(false); } private: System::Void timer1_Tick(System::Object * sender, System::EventArgs * e) { label1->Text=(API::Free_RAM()).ToString(); } }; }
__________________ Last edited by MrSeanKon; 5th February, 2007 at 09:32 AM. |
| ||||
The c++ code you wrote is still using the .NET stuff, so you are taking a performance hit there.... |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Rate This Thread | |
| |
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Motorola 68000 Programming Help | aghastpumpkin | Programming and Assembly Language | 9 | 23rd January, 2007 01:15 PM |
Drining and programming: VERY BAD! | dpgdog187 | 64 Bit computing | 13 | 12th June, 2004 01:55 AM |
920 Programming Languages | cloasters | Programming and Assembly Language | 0 | 20th September, 2003 12:28 AM |
C/C++ Programming Forum ? | barneygumble742 | Programming and Assembly Language | 2 | 28th June, 2003 02:59 AM |
Need Programming Help | Oc Jason | Programming and Assembly Language | 7 | 5th April, 2002 06:34 PM |