| |||||||
| Programming and Assembly Language Please read this Topic's rules!! |
![]() |
| | LinkBack | Thread Tools | Rate Thread |
| ||||
| Which C platform is better for programming? I was discussing with gizmo at MSN about Visual C++ vs C#. Well I started programming the OcBible using Borland C++ Builder (2003) and at May of 2005 I moved to C#. The heart of the program could be written in ANSI C but I want to share something well looking.
__________________ GRAB overclocking -->OcBible v1.55 Guidemania v1.21 CARDGAMES-->Jack v1.17 Deck v1.13 Preference v1.20 |
| ||||
| 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.
__________________ Avatar and sig graphic by Pitch. Subscribers! Ask about a custom graphic or avatar today! Gizmo Thermal Diode Mod and Direct-Die Water Block 8-Cheetah 18GiB U-2 SCSI MegaRAID Enterprise 1500/128MiB Samsung SyncMaster 955DF TTGI/Superflower TTS-520 PSU ![]() ![]() ![]() Last edited by Gizmo; 7th January, 2007 at 04: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.
__________________ Avatar and sig graphic by Pitch. Subscribers! Ask about a custom graphic or avatar today! Gizmo Thermal Diode Mod and Direct-Die Water Block 8-Cheetah 18GiB U-2 SCSI MegaRAID Enterprise 1500/128MiB Samsung SyncMaster 955DF TTGI/Superflower TTS-520 PSU ![]() ![]() ![]() |
| ||||
| 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:
__________________ Avatar and sig graphic by Pitch. Subscribers! Ask about a custom graphic or avatar today! Gizmo Thermal Diode Mod and Direct-Die Water Block 8-Cheetah 18GiB U-2 SCSI MegaRAID Enterprise 1500/128MiB Samsung SyncMaster 955DF TTGI/Superflower TTS-520 PSU ![]() ![]() ![]() |
| ||||
| Thanks gizmo. BTW have you ever used an alternate graphical C enviroment?
__________________ GRAB overclocking -->OcBible v1.55 Guidemania v1.21 CARDGAMES-->Jack v1.17 Deck v1.13 Preference v1.20 |
| ||||
| I used Borland Turbo C many years ago with the Object Windows Libraries (OWL)
__________________ Avatar and sig graphic by Pitch. Subscribers! Ask about a custom graphic or avatar today! Gizmo Thermal Diode Mod and Direct-Die Water Block 8-Cheetah 18GiB U-2 SCSI MegaRAID Enterprise 1500/128MiB Samsung SyncMaster 955DF TTGI/Superflower TTS-520 PSU ![]() ![]() ![]() |
| ||||
| 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 04:42 AM. |
| ||||
| What do you mean?
__________________ GRAB overclocking -->OcBible v1.55 Guidemania v1.21 CARDGAMES-->Jack v1.17 Deck v1.13 Preference v1.20 |
| ||||
| 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 ETERNAL." DKE "All that we do is touched by Ocean Yet we remain on the shore of what we know." Richard Wilbur ![]() 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
__________________ Dell Inspiron 6000 1.73GHz Intel "Sonoma" 1GB DDR2 533 ATI X300 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.
__________________ Avatar and sig graphic by Pitch. Subscribers! Ask about a custom graphic or avatar today! Gizmo Thermal Diode Mod and Direct-Die Water Block 8-Cheetah 18GiB U-2 SCSI MegaRAID Enterprise 1500/128MiB Samsung SyncMaster 955DF TTGI/Superflower TTS-520 PSU ![]() ![]() ![]() |
| ||||
| 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 03: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 03:32 AM. |
| ||||
| The c++ code you wrote is still using the .NET stuff, so you are taking a performance hit there....
__________________ Avatar and sig graphic by Pitch. Subscribers! Ask about a custom graphic or avatar today! Gizmo Thermal Diode Mod and Direct-Die Water Block 8-Cheetah 18GiB U-2 SCSI MegaRAID Enterprise 1500/128MiB Samsung SyncMaster 955DF TTGI/Superflower TTS-520 PSU ![]() ![]() ![]() |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Rate This Thread | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Motorola 68000 Programming Help | aghastpumpkin | Programming and Assembly Language | 9 | 23rd January, 2007 07:15 AM |
| Drining and programming: VERY BAD! | dpgdog187 | 64 Bit computing | 13 | 11th June, 2004 07:55 PM |
| 920 Programming Languages | cloasters | Programming and Assembly Language | 0 | 19th September, 2003 06:28 PM |
| C/C++ Programming Forum ? | barneygumble742 | Programming and Assembly Language | 2 | 27th June, 2003 08:59 PM |
| Need Programming Help | Oc Jason | Programming and Assembly Language | 7 | 5th April, 2002 12:34 PM |