Elbaron's Posts
Nairaland Forum › Elbaron's Profile › Elbaron's Posts
Ajisafe. Thank you for your post. However, I did not call anybody's writtings a conjecture. All I said was that YOUR write up was made of conjectures and half truths. In other words, I was talking about what you wrote and not what AbduRahman wrote. I respect your believe and religion and have nothing against it. But when you want to juxtapose the bible with your teachings and believes, it kind of makes it all very confusing. Dont get me wrong, I like the fact that you are posting these topics, you may even get me as a revert some day if you are able to convince me. I am only saying that I see no relationship with what was written in the bible as you quoted and the inference you are drawing. That is my opinion and I believe I am entitled. By the way, I am Nigerian and Ibo not Ghanaian. I just happen to be living in Ghana at the moment. According to the text you quoted, five members of the family would be divided amongst themselves, three against two and two against three, have you noticed the goings on in Iraq lately? Where sunni and Shiite Moslem's are slaughtering themselves like Christmas goat? How will you interprete that? Before you call my beliefs an illusion, did you make an attempt to consider the writtings of your own prophet about my believe? Brother, it will do us good to keep it civil. We are all entitled to our views. I will appreciate an education from you on this issue. Just as a matter of interest, if AbduRahman will quote verses from the bible and you will base your opinions (viz: Jesus prophesied islam) on these very same verses, would it not be fair to say that both you and AbduRahman believe the writings of the bible? And if this is so, would it not be safe to assume that Abdurahman believed in the existence of Jesus? If this further assumption is correct and the bible makes it clear that Jesus is the Son of God, and you are implying that I am putting words in AbuRahman's mouth, are you then saying that AbduRahman accepts only portions of the bible that suit his fancy? I would certainly hope not. By the way, I use both the Bible and the Koran as a point of historical reference only. Have a nice day. My most sincere regards |
The purpose of this tutorial is to give a good understanding of the programming language C++ to any person that wants it. So what is C++? Why are so many programs written in C++? C++ is a third generation programming language. When computers were first invented, they were programmed with very simple, low-level commands. A programmer would design a program, then translate the program into a specific set of codes, known as machine language. These codes would be fed into a computer with switches, punch-cards, or primitive keypads. These programs were cumbersome to write, and very hard to debug. (Debugging is the act of removing mistakes in a program.) Machine code is considered the first generation of programming languages. Assembly languages are considered the second generation of programming languages. Assembly languages allow a programmer to design a program and translate it into machine language using a piece of software called an assembler. Most assembly languages are still very cumbersome to work with. However, the biggest disadvantage of assembly languages is that they are processor-specific. This means that programs written in assembly language will only work on processors similar to the one of the machine that they were written on. Third generation languages are compiled languages. These languages are not processor-specific. In theory, a program written in a third generation language will be able to run on any other machine. This is not always the case, due to a number of factors. Third generation languages are much more abstract than assembly languages. Third generation languages are translated into assembly language by a complicated piece of software called a compiler. A compiler can be thought of a a language translater C++ is a very useful language, because it gives the programmer a lot of control, but also is abstract enough so development can be done fairly quickly. C++ is a very portable language as well, because it is a third-generation language, and because it has a well defined set of standards written for it. So, what exactly is a programming language? As a loose definition, a programming language is a tool used by a programmer to give the computer very specific instructions in order to serve some purpose for the user. A program is like a recipe. It outlines exactly the steps needed to create something or perform a certain task. For, example, when baking chocolate chip cookies, there are certain steps that need to be followed: mix eggs, butter, sugar in a bowl add flour, baking soda, and flavorings mix until creamy add chocolate chips bake in the oven. For a person who has made cookies before and knows the amounts of each ingredient to use, this recipe is sufficient, however, for a person who has never baked cookies before, this recipe will not do. That person would need a recipe like the following: place two eggs in a bowl add 1.5 c. butter to the eggs bake cookies for 10-12 minutes at 375 degrees or until brown There is still a problem with the preceding recipe. The first instruction says to put two eggs in the bowl, but it doesn't say to shell them first! This may seem like common sense, but it illustrates a fundamental concept: computers do exactly what they are told, no more, no less. When writing a program, a programmer must outline every possible step and scenario that could occur. The first programming languages that emerged, were assembly languages. These languages are exactly the instruction set of a specific processor. These languages are very low-level and hard to understand. For example, say we wanted to add two numbers, 3 and 4 and get a result: in C++: in assembly: int a = 3 + 4; ldl 3, R1 ldl 4, R2 addl R1, R2, R3 The version in C++ is easier to understand and simpler to write. This is analagous to the differences in the first recipe presented and the second recipe presented. The first recipe expressed the method of baking cookies on a high level, while the second method went more in depth on how to actually mix and bake the cookies. Programmers write their code in a high level language and then use a compiler to translate their code into an assembly language and then into a machine language that will run on the machine they are using. Programs consist of algorithms. An algorithm is just a well-outlined method for completing a task. The above recipes could be called algorithms for the task of baking cookies. A high level algorithm for adding two numbers could be as follows: ask the user for the first number ask the user for the second number add the two numbers display the result on the screen This high-level abstraction is not actual code. However, it does express the ideas of a program, and is called pseudo-code. Often, programmers will design their programs in pseudo-code, and then use this to write their actual code. So, why is there more than one programming language? It may seem that a standard language should be agreed on, since all languages are translated using a compiler anyways. However, languages are often designed with a specific use in mind, and some are better than others for dealing with certain problems. So if a programmer is capable of writing a compiler (which is a very complex piece of software) then they can design and create a language. The most important thing to remember about programming languages is that they are only an abstraction! Programming languages were created so developers could express their ideas on a higher level than a computer can understand. Once a user has a good concept of how computers work, and has learned a few computer languages, it becomes much easier to pick up new languages. A programming language is a tool used by programmers in order to specifically outline a series of steps that a computer is to take in a certain instance. High-level programming languages allow a programmer to express ideas on an abstract level, and forces the compiler to worry about the low-level implementation details. This allows for faster development of applications, since applications are easier to write. There are even fourth generation languages emerging as viable programming languages. Recall that machine code is considered first generation, assembly languages are second generation, compiled languages are third generation. Fourth generation languages are actually code-generating environments, such as Microsoft's Visual Basic. These fourth generation languages allow programmers to express their ideas visually, and the environment then writes the code to implement these ideas. Before diving right into the nitty-gritty of C++ language details, let's get started with a full-fledged C++ program! The idea of this program is to introduce you to the overall structure of a C++ program and give you the flavor of C++. Here, then, is an entire C++ program: //include this file for cout #include <iostream.h> int main() { //print out the text string, "Welcome, to Nigeria. Our home, our Heritage!" cout << "Welcome, to Nigeria. Our home, our Heritage!" << endl; return 0; } To prepare for the next section, create a new text file and save this code into the file. If you are on a unix machine, save the file with the filename nigeria.C (make sure it ends with .C, not .c! That is a capital C). If you are on a Windows machine, save the file with the filename hello.cpp. You're now ready to compile and run your program, covered in our next lesson. See you tommorrow. |
c0dec has just informed me that not too many full time programmers hang out here. So I think it will be disastrous as well as defeat the purpose of this forum to continue writing on this topic. I have, however, decided to to do a step by step tutorial on C++. I hope you find it useful. c0dec, thanks again. |
Thanks a lot c0dec. I am just finishing a tutorial on the basics of C and should post it before I sleep. Thanks again for the pointer |
I would suggest you start with C and graduate to C++. Delphi is also not a bad a language to learn for web development. For those recomending .Net and visual basic. You must understand that those languages are used sorely for the purpose of developing windows applications. C++ is it for a programmer who is worth his onion. Not only does it give you versatility, it is also the mother of all languages. Think about it. |
Ask again damygurl. However, our brother from the other faith are doing their very best to bring out the best in them. That is quite commendable. So Jesus prophesied Islam? This a very good write up made of conjectures, half truths and misinterpretations. However, I am glad you recognise Jesus as the son of God. Keep up the spirit |
Quite a nice write up. But two things are not clear to me. Are you saying that the word "dust" as stated in the bible is not to be taken figuratively? If you do, on what basis are you founding this assumption. What scientific or cultural evidence exists to support this claim? Again, if you meant that the word "dust" or to use your own word "earth ground/ clay" is not to be taken figuratively and is to be construed to mean sperm, would this not be a little contradictory? You stated yourself, in your closing remarks and i quote "35:1 "Praise be to Allah, Who created (out of nothing) the heavens and the earth, Who made the angels, messengers with wings,- two, or three, or four (pairs): He adds to Creation as He pleases: for Allah has power over all things." If you agree that God created us "out of nothing" where did the semen come from? My understanding of basic biology is that the male semen fertilizes the male egg. Where did God get the semen from and who did he copulate with to fertilize her eggs? Do you begin to understand? According to you, even the Koran says that God created out of nothing. If God created out of nothing where, then, did you get the semen insight from? You stated that God created Jesus from the dust. Let me quote your text "3:59 "The similitude of Jesus before Allah is as that of Adam; He created him from dust, then said to him: "Be". And he was." Where did this come from? At what point did God create Jesus and from which dust? Did you not read in John 1:1 that in the beginning was the word and the word was with God and the word was God? At which point in this your exposition of evolution did God create Jesus? Are you asserting that Jesus was created in the same mode as Adam? If so, did you ever read that "the spirit of God visit Mary and she conceived of a child". Are you suggesting that this biblical testimony is faulty or inaccurate? If it is, I would surely want to hear about it. Your theory is asserting that Adam's "spirit was created before he came to earth". From my understanding of simple English, coming to a place means that the person who is coming must be moving from one point in other to arrive at another. Where was Adam coming from? Adam, according to my bible was greater in the image and likeness of God, molded out of dust in exactitude to God's image. My bible further tells me that God breathed in him the breath of life. My interpretation of this, is that God shared a part of his own soul with Adam. Which is in contra-distinction to your "his spirit was created before he came to earth in human body". I would suggest that you research further on this topic. Thanks, though, for taking the time to express your views. And may God guide you in all that you do. My sincere regards. |
The Roman Catholic Church, headquartered in Rome, Italy, has its own powerful City-State, the Vatican, and claims over 968 million members worldwide and 60 million in the U.S. and Canada (as of 1996). (Catholic membership figures are considerably misleading, though, in that they count as members every person who has been baptized Catholic, including millions of people who were baptized as infants but who are not practicing Catholics.) The Roman Catholic Church, in its pagan form, unofficially came into being in 312 A.D., at the time of the so-called "miraculous conversion" to Christianity of the Roman Emperor Constantine. Although Christianity was not made the official religion of the Roman Empire until the edicts of Theodosius I in 380 and 381 A.D., Constantine, from 312 A.D. until his death in 337, was engaged in the process of simultaneously building pagan temples and Christian churches, and was slowly turning over the reigns of his pagan priesthood to the Bishop of Rome. However, the family of Constantine did not give up the last vestige of his priesthood until after the disintegration of the Roman Empire -- that being the title the emperors bore as heads of the pagan priesthood -- Pontifex Maximus -- a title which the popes would inherit. (The popes also inherited Constantine's titles as the self-appointed civil head of the church -- Vicar of Christ and Bishop of Bishops.) Prior to the time of Constantine's "conversion," Christians were persecuted not so much for their profession of faith in Christ, but because they would not include pagan deities in their faith as well. Then, with Constantine's emphasis on making his new-found Christianity palatable to the heathen in the Empire, the "Christianization" of these pagan deities was facilitated. For example, pagan rituals and idols gradually took on Christian meanings and names and were incorporated into "Christian" worship (e.g., "saints" replaced the cult of pagan gods in both worship and as patrons of cities; mother/son statues were renamed Mary and Jesus; etc.), and pagan holidays were reclassified as Christian holy days (e.g., the Roman Lupercalia and the feast of purification of Isis became the Feast of the Nativity; the Saturnalia celebrations were replaced by Christmas celebrations; an ancient festival of the dead was replaced by All Souls Day, rededicated to Christian heroes [now Hallowe'en]; etc.). A transition had occurred -- instead of being persecuted for failure to worship pagan deities, Christians who did not agree with the particular orthodoxy backed by the Emperor were now persecuted in the name of Christ! "Christianized" Rome had become the legitimate successor of pagan Rome! This is the sad origin of the Roman Catholic Church. Below are the highlights of what Catholics believe concerning their source of authority; God, Christ, and Mary; salvation and the sacraments; and heaven and hell. So much more could be said concerning not only the items listed below, but also concerning other areas of Catholic teaching (such as the claims of the Roman priesthood and its supposed origin in the Apostles; the nature of the pope's alleged infallibility and the supposed origin of his office in the Apostle Peter; the nature of the Confessional; the doctrine of penance/indulgences; practices concerning rituals, ceremonies, and relics; the doctrine of Celibacy; policies on marriage and divorce; the role of the parochial school; etc.). Excellent reference sources for a thorough treatment of Catholicism’s origins, beliefs, and practices would be Roman Catholicism (466 ppgs.) and A Woman Rides the Beast (544 ppgs.). 1. Source of Authority. With respect to the Bible, Catholics accept the apocryphal books in addition to the 66 books of the Protestant Bible. They also accept tradition and the teaching of the Catholic Church as authoritative and at least equal to that of the Bible (cf. Mk. 7:8,9,13; Matt. 15:3,6,9; Col. 2: . With respect to papal infallibility, Catholics believe that ecumenical councils of bishops and the pope are immune from error when speaking ex cathedra about faith and morals (i.e., "from the chair" -- by sole virtue of position or the exercise of an office). (And by "infallible," Catholics mean much more than merely a simple, de facto absence of error -- it is positive perfection, ruling out the possibility of error. For more on infallibility, see notes on Vatican II below). In actuality, Roman Catholicism places itself above Scripture; i.e., it teaches that the Roman Catholic Church produced the Bible and that the pope is Christ's vicar on earth. Catholics also maintain the belief in sacerdotalism -- that an ordained Catholic priest has the power to forgive sins (cf. 1 Tim. 2:5). 2. Jesus Christ. Catholicism teaches that Christ is God, but they, nevertheless, do not believe that Christ's death paid the full penalty for sin; i.e., they believe that those who qualify for heaven must still spend time in purgatory to atone for sin (cf. Jn. 19: 30; Heb. 10:11,12). 3. Mary. The Catholic Church gives honor and adoration to Mary that the Scriptures do not; she is readily referred to as "holy," the "Mother of God," and has been dubbed the "Co-Redemptrix," thereby making her an object of idolatrous worship (e.g., the rosary has ten prayers to Mary for each two directed to God). In 1923, Pope Pius XI sanctioned Pope Benedict XV's (1914-1922) pronouncement that Mary suffered with Christ, and that with Him, she redeemed the human race. And Pope Pius XII officially designated Mary the "Queen of Heaven" and "Queen of the World." Catholics claim not only that Mary was perfectly sinless from conception, even as Jesus was (doctrine of Immaculate Conception, proclaimed by Pope Pius IX in 1854), but that the reason she never sinned at any time during her life was because she was unable to sin (cf. Lk. 1:46,47; Rom. 3:10,23; 5:12; Heb. 4:15; 1 Jn. 1:8,10). Catholics also believe that Mary was a perpetual virgin (cf. Ps. 69:8; Matt. 1:24,25; 13:54-56; Mk. 6:3; Jn. 7:5), and that she was assumed, body and soul, into heaven (doctrine of Assumption of Mary, declared ex cathedra by Pope Pius XII in November of 1950 -- that Mary was raised from the dead on the third day after her death, and anyone who refuses to believe this has committed a mortal sin). The consequence of all this veneration of Mary, in effect, establishes her authority above Christ's -- Rome says, "He came to us through Mary and we must go to Him through her." All this is so obviously idolatrous, one wonders why Catholics take offense when their religious affections are called cultic. 4. Salvation. Catholics teach that a person is saved through the Roman Catholic Church and its sacraments, especially through baptism; they do not believe that salvation can be obtained by grace through faith in Christ alone, but that baptism is essential for salvation. Catholics believe that no one outside the Catholic Church can be saved (Unum Sanctum) (cf. Jn. 5:24; Eph. 2: 8,9; Gal. 2:21; Rom. 3:22,23). (See also The Second Vatican Council's Decree on Ecumenism and the New Catholic Catechism (paras 819 and 846.) They also believe that one's own suffering can expiate the sin's of himself and of others, so that what Christ's suffering was not able to achieve, one can achieve by his own works and the works of others (Vatican II). 5. Sacraments. Catholics have seven sacraments: baptism, confirmation, Eucharist (mass), penance/reconciliation (indulgences), extreme unction (last rights), marriage, and orders (ordination). Although not even formally decreed until the Council of Florence in 1439, the Council of Trent later declared all to be anathema whom do not hold Rome's position that it was Christ Himself who instituted these seven sacraments! (The idea behind the sacraments is that the shedding of Christ's Blood in His death upon the cross is of no value unless it is somehow dispensed and applied "sacramentally" by the Catholic priesthood.) Although Catholics believe that the first five sacraments are indispensable for salvation (because without any one of them, a mortal sin has been committed), baptism is considered the most important. Catholics believe that a person enters into the spiritual life of the Church through baptism; i.e., baptismal regeneration -- that a person can be saved through baptism (actually, 'on the road to salvation,' because Catholics never know exactly when they are saved). They practice infant baptism because they believe baptism erases original sin (cf. Jn. 3:18). 6. The Mass. Unknown in the early church, the mass did not become an official doctrine until pronounced by the Lateran Council of 1215 under the direction of Pope Innocent III, and reaffirmed by the Council of Trent. The Church of Rome holds that the mass is a continuation of the sacrifice that Christ made on Calvary -- in effect a re-crucifixion of Christ over and over again in an unbloody manner (cf. Heb. 9:22; 1 Jn. 1:7). They believe that by this means Christ offers Himself again and again as a sacrifice for sin (cf. Heb. 7:27; 9:12,25,26; 10:10,12,14,18), and that this sacrifice is just as efficacious to take away sin as was the true sacrifice on Calvary. Catholics thus teach the doctrine of transubstantiation (meaning a change of substance) -- that the bread and wine (at communion) actually become (by the power of the priest!) the body and blood of Christ, which is then worshiped as God Himself! Indeed, the sacrifice of the mass is the central point of Catholic worship, as evidenced by the fact that those abstaining from attending mass are considered to have committed a mortal sin. 7. Purgatory. Though of pagan origin, the doctrine of purgatory was first conceptualized in the professing church in the second century; the Roman Church proclaimed it as an article of faith in 1439 at the Council of Florence, and it was confirmed by Trent in 1548. The Catholic Church teaches that even those "who die in the state of grace" (i.e., saved and sins forgiven) must still spend an indefinite time being purged/purified (i.e., expiated of sins/cleansed for heaven). (Technically, this "purging" can occur in this life rather than in purgatory itself, but as a practical matter, purgatory is the best the average Catholic can hope for.) Some Catholics will admit that the doctrine of purgatory is not based on the Bible, but on Catholic tradition (which, by Catholic standards, is equally authoritative) (cf. Jn. 5:24; Lk. 23:43; 1 Jn. 1:7,9; Phil. 1:23). (Others teach that it is based upon the interpretation of several Scriptural texts -- 1 Cor. 3:15; 1 Pe. 1:7; 3:19; Matt. 12:31.) They teach that those in purgatory can be helped by the prayers and good works of those on earth (which would include the "purchase" of masses and/or other indulgences), but they are not certain how these prayers and works are applied (cf. 2 Pe. 1:9; Heb. 1:3; Jn. 3:18; 19:30; 2 Cor. 5:6- .8. The Church Councils. There have been three major Roman Catholic Councils: Council of Trent (1545-1563), Vatican I (1869-1870), and Vatican II (1962-1965). The last Council, Vatican II, offered no new doctrines nor repudiated any essential teaching of the Roman Church; it referred to Trent dozens and dozens of times, quoted Trent's proclamations as authority, and reaffirmed Trent on every hand. Even the New Catholic Catechism (1992/1994) cites Trent no less than 99 times! There is not the slightest hint that the proclamations of the Council of Trent have been abrogated by Rome. At the opening of the Second Vatican council, Pope John XXIII stated, "I do accept entirely all that has been decided and declared at the Council of Trent," and all of the Catholic leaders who attended Vatican II signed a document containing this statement. (The last pope, Pope John Paul II, has even cited the Council of Trent as authority for his blasphemous position on Mary.): Council of Trent -- The Council of Trent was held in an attempt to destroy the progress of the Protestant Reformation; it approved many superstitious and unbiblical beliefs of the Middle Ages (all to be believed under the threat of "anathema" :(a) Denied every doctrine of the Reformation, from Sola Scriptura to "salvation by grace through faith alone"; (b) Pronounced 125 anathemas (i.e., eternal damnation) upon anyone believing what evangelicals believe and preach today; (c) Equal value and authority of tradition and Scripture (in actuality, tradition is held above Scripture); (d) Scriptures for the priesthood only (prohibited to anyone in the laity without written permission from one's superior -- to violate this was [and still is in most "Catholic countries" today] considered a mortal sin); (e) Seven sacraments; (f) Communion by eating the bread only (not drinking the wine); (g) Purgatory; (h) Indulgences; (i) The Mass as a propitiatory offering. Vatican I (a) Defined the infallibility of the pope; (b) Confirmed Unum Sanctum (no salvation outside of the Catholic Church). Vatican II -- made no new doctrines, nor did it change or repudiate any old ones; Trent and Vatican I stand as is (i.e., Vatican II verified and validated all the anathemas of Trent). Vatican II reaffirmed such Roman heresies as papal supremacy; the Roman priesthood; the mass as an unbloody sacrifice of Christ; a polluted sacramental gospel; Catholic tradition on equal par with Scripture; Mary as the Queen of Heaven and co-Redemptrix with Christ; auricular confession; Mariolatry; pilgrimages to "holy shrines"; purgatory; prayers to and for the dead; etc. (Although the restriction against laity reading the Scriptures has been removed, it is still a mortal sin for a Roman Catholic anywhere to read any Protestant version of the Bible. That the real attitude of the Vatican toward the Bible has not changed is shown by the fact that in 1957 the depot of the British and Foreign Bible Society in Madrid, Spain was closed and its stock of Bibles confiscated and burned.) (a) Reaffirmed the infallibility of the pope (and even when he does not speak ex-cathedra, all Catholics must still give complete submission of mind and will to what he says); (b) Divided Catholic doctrine into that which is essential core of theology, and must be received by faith, and that which is still an undefined body of theology which Catholics may question and debate without repudiating their essential Catholicism; (c) Established 20 complex rules concerning when and how any indulgence may be obtained, and condemned "with anathema those who say that indulgences are useless or that the Church does not have the power to grant them ... [for] the task of winning salvation." [Back to Text] A Sampling of the Anathemas of Trent: If any one shall deny that the body and blood together with the soul and divinity of our Lord Jesus Christ, and therefore entire Christ, are truly, really, and substantially contained in the sacrament of the most holy Eucharist; and shall say that He is only in it as a sign, or in a figure, or virtually -- let him be accursed (Canon 1). If any one shall say that the substance of the bread and wine remains in the sacrament of the most holy Eucharist, together with the body and blood of our Lord Jesus Christ, and shall deny that wonderful and singular conversion of the whole substance of the bread into the body, and of the whole substance of the wine into the blood, the outward forms of the bread and wine still remaining, which conversion the Catholic Church most aptly calls transubstantiation -- let him be accursed (Canon 2). If any man shall say that Christ, the only begotten Son of God, is not to be adored in the holy sacrament of the Eucharist, even with the open worship of latria, and therefore not to be venerated with any peculiar festal celebrity, nor to be solemnly carried about in processions according to the praiseworthy, and universal rites and customs of the holy Church, and that he is not to be publicly set before the people to be adored, and that his adorers are idolaters -- let him be accursed (Canon 6). If anyone shall say that the ungodly man is justified by faith only so as to understand that nothing else is required that may cooperate to obtain the grace of justification, and that it is in no wise necessary for him to be prepared and disposed by the motion of his own will ... let him be accursed (Canon 9). If anyone shall say that justifying faith is nothing else than confidence in the divine mercy pardoning sins for Christ's sake, or that it is that confidence alone by which we are justified ... let him be accursed (Canon 12). |
Introduction Welcome to the first article in a series of three articles on Managed C++, or, to use its proper name, Managed Extensions for C++. (Note: I will use the terms "Managed Extensions," "MC++," and "Managed C++" interchangeably in this series.) Managed C++ often gets a bum rap in the world of .NET. Some of it is deserved, some is not, and some comes from just plain misunderstanding. Some people have even gone as far as terming it a "dead" language and of little use in a managed world filled with C# and VB. While it is certainly true that managed languages such as C# and VB have greatly increased developer productivity and simplified development in many areas (such as RAD UI development with Windows Forms), there are many areas where Managed C++ still is the best choice, or even maybe the only choice, in implementation language. These articles, and in particular this article, are designed to probe these questions and clear up some of the confusion that surrounds MC++, help you understand the advantages and disadvantages, and teach you some of the basics of the language so that you can put it in use in your applications today. Target audience This article, and this series, assumes that the reader is familiar with the basics of the .NET Framework (including the CLR) and has worked with "managed" languages such as C# and VB.NET. The reader may or may not be a C++ programmer. It helps, certainly, but adventuresome programmers are certainly welcome! But isn't C++/MC++ a dead language? Due to the constant hype coming out of Microsoft and other places, there is a common misconception that Managed C++ and C++ itself are "dead" languages, and have no place, or part to play, in the world of the CLR. Nothing could be further from the truth. While it is absolutely true that C# is a "simpler" and highly productive language, it is not the be all and end all of languages. There are, quite simply, not only classes of applications that are more suitable for Managed C++, but also classes of applications that cannot even be created for .NET with any other language. Often, several languages are suitable for a given task. The choice of programming language can be influenced by the experience of the programmers, as well as aesthetic preferences. Indeed, this is one of the major advantages of the .NET platform, in that there is a lot of choice when deciding what programming language should be used for development. This is, of course, possible because all .NET language compilers are required to emit IL rather than native code. To a certain extent, this IL generated by a .NET compiler is more or less the same, which could lead one to the conclusion that the language used to create the managed type is irrelevant. Certainly, this is an impression that Microsoft drives home often -- people like me even claim "It's the Runtime Stupid!" But the fact of the matter is that this is not strictly true, as the C++ compiler performs some optimization on the IL it produces, resulting in code that performs better than code generated from the C# or VB.NET compilers. Some of these languages provide conveniences that result in extra IL. Are these two points important in your .NET application? It depends on the application. Any good programmer, including any good .NET programmer, keeps a toolbox of languages and tools that most suit the problem at hand. Given the whole slew of languages available for .NET, why should one pick C++ to write .NET code? Advantages of Managed C++ C++ is arguably the most powerful language ever invented. (And people do argue about things like this constantly!) It has always been a systems language, and it gives you the power and flexibility to produce truly flexible and innovative solutions. It is also one of the most widely used, and a first choice in implementing solutions from operating systems to office suites and most anything in between, resulting in the existence of billions of lines of C++ code, with millions more added every year. This same spirit has been carried over to MC++, where you have not only complete access to all of the features of the .NET Framework, but also the full power of the unmanaged language as well. To this point, MC++ is the only language where you can mix managed (.NET) code and unmanaged code in the same assembly, and even in the same source file. Here are some specific advantages of MC++: The best performance of generated IL code because of both optimizations of the generated IL and less IL generated (as discussed in the previous section). This is specifically because MC++ is the only .NET compiler with a full optimizer back end, which is pretty much the same one that is used by the unmanaged compiler. MC++ is your language of choice if you want full control of the .NET environment: Allows one to use all seven levels of CTS member access. C# allows only six. Allows direct access to interior gc pointers, useful in a whole class of system applications such as system and .NET utilities. Offers explicit control of expensive operations like boxing. Supports multiple indexed properties on a type, unlike C#. MC++ is currently the only managed language that allows you to mix unmanaged and managed code, even in the same file. This leads to several other points: Allows a developer to keep performance-critical portions of the code in native code. Gives seamless access to all unmanaged libraries, such as DLLs, statically-linked libraries, COM objects, template libraries, and more. Leverages existing investments in C++ programming skills and legacy C++ code. Porting unmanaged code to .NET: MC++ allows you to take existing unmanaged code and compile it to managed code (with the /clr compiler switch and IJW). Gives the ability to port code at one's own rate rather than re-write all at once. Provides the easiest way to add .NET support to your existing native C++ Windows applications, by allowing you to bridge the gap between the two environments with as little work on your behalf as possible, and with the lowest performance penalty. MC++ is currently the only language that allows some form of multi-paradigm design and development with full support for generic programming and templates. This can lead to more options and better designs and implementations. Disadvantages of Managed C++ C++ is a more complex language than C# in both its syntax and areas where one could get into trouble. Since MC++ follows the C++ paradigm of "explicit is good", some MC++ constructs may seem really ugly. For simpler types of applications, and with certain types of developers, it may make more sense to use C#. Managed C++ code is non-verifiable, since C++ can perform unsafe operations. The implication of this is that MC++ code may not run in restricted environments that will not run code that is non-verifiable. Some minor features of the .NET platform are not supported yet, such as jagged arrays. IDE support is currently lacking, compared to other managed languages, since there's little or no designer support (but Everett will change this). What exactly are Managed Extensions for C++? Managed extensions for C++ are extensions to the Visual C++ compiler and language to allow them to create .NET code and enable access to the functionality of the .NET Framework. They include a set of keywords and attributes to extend the C++ language to work with, and generate, managed code. There are also some additional pragmas, pre-processor directives, and options for the compiler, as well as some linker options. The first interesting thing to notice is that the Managed Extensions use C++ keywords and syntax, but they follow .NET rules for types and facilities. This creates, in effect, a language within a language. The following sections show all of these for reference: Keywords Description __abstract Declares a class that cannot be instantiated directly. __box Creates a copy of a __value class on the common language runtime heap. __delegate Declares a reference to a unique method (a function pointer) of a managed class. __event Declares an event method of a managed class. __finally Declares a finally block associated with a try block. __gc Declares a gc type. __identifier Enables the use of a C++ keyword as an identifier. __interface Declares an interface. __nogc Declares a native C++ class that is not garbage-collected. __pin Prevents an object or embedded object of a managed class from being moved by the common language runtime during garbage collection. __property Declares a property member for a managed class. public, protected, and private Determines the accessibility of specified types and methods outside of an assembly. __sealed Prevents a __gc class from being a base class, or a method from being overridden by one in a derived class. __try_cast Performs the specified cast or throws an exception if the cast fails. __typeof Returns the System::Type of a given type. __value Declares a value type. Attributes Attribute Description Creates a user-defined attribute. Pragmas Pragma Description managed, unmanaged Determines if code is compiled to MSIL or unmanaged code. Preprocessor directives Directive Description #using Imports metadata into a managed application. For more information, see "21.4 Importing Metadata with #using" Metadata as Binary Headers" in the Managed Extensions specification. Compiler options Option Description /AI Specifies a directory to search to resolve file references passed to the #using directive. /clr Compiles C++ and Managed Extensions for C++ source code to MSIL. /FU Forces the use of a file name, as if it had been passed to the #using directive. Linker options Option Description /ASSEMBLYMODULE Adds a MSIL module to the assembly of a project. /ASSEMBLYRESOURCE Adds a link to a managed resource from a project. /NOASSEMBLY Creates a MSIL module that is not an assembly by itself, but can be part of an assembly. Your first Managed C++ program Okay, ready to dive in? Let's look at the simplest possible program. #using mscorlib.dll; // required for MC++ void main() { System::Console::WriteLine(S"Managed C++ Rocks!!" ;} This can either be built as a Visual Studio .NET Managed C++ console application or from the command line using the /CLR compiler option. To do this, you can open a command window using the VS.NET command window, as follows: C:\Code\trial\HelloWorld>cl /CLR HelloWorld.cpp Microsoft (R) C/C++ Optimizing Compiler Version 13.10.2292 for .NET Framework Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. HelloWorld.cpp Microsoft (R) Incremental Linker Version 7.10.2292 Copyright (C) Microsoft Corporation. All rights reserved. /out:HelloWorld.exe HelloWorld.obj C:\Code\trial\HelloWorld>HelloWorld Managed C++ Rocks!! The first statement of the program is a preprocessor directive, the #using statement. This directive tells the compiler to find and load the assembly mscorlib.dll, which contains the .NET BCL (Base Class Library, i.e. System). Console is the BCL class for basic text I/O and the WriteLine method prints out a string. The prefix S tells the compiler that this is a managed string literal. What scenarios are they good for? Although one could write all of their managed code in MC++, there are certain scenarios that lend either an advantage to using MC++, or require it altogether to accomplish the task. Interop directly with existing unmanaged code native, or unmanaged code, is, of course, code that existed before .NET and cannot take advantage of any of the runtime's features, as it runs outside the CLR. One thing is certain: there are millions of lines of existing native C++ code and there are likely to be for some years to come. One of the areas that MC++ excels in, and is in fact unique in amongst the .NET languages, is the ability to take an existing unmanaged (C++) application, recompile it with the /clr switch, have it generate MSIL and then run under the CLR, unmanaged. This extraordinary feat is aptly termed "It Just Works (IJW)!" There are some limitations, but for the most part, the application will just run. The C++ code can consist of old-fashioned printf statements, MFC, ATL, or even templates! IJW is one form of Interop. There are also COM Interop and Platform Invoke (P/Invoke). The important thing to note is that MC++ is unique amongst CLR languages in this ability to directly interoperate with native code. Managed wrappers around Existing Native Code Building on IJW; not only will MC++ let you interoperate directly with native code, but it is unique in the ability of creating "managed wrappers." This combination of unmanaged and managed code allows developers to expose unmanaged C++ functionality to other managed languages like C#, Eifel.NET, and VB.NET. MC++ allows you to mix native and managed code even in the same file; this is extremely valuable. This allows developers to "port" a native application to a managed one, a portion at a time. Moreover, it allows the developer to choose which portions of the native functionality they wish to "expose" to managed clients through the managed wrapper. We have already mentioned that MC++ generates IL that performs better due to the ability of the MC++ compiler to optimize the generated IL. However, there are currently applications that, for performance reasons, will have to maintain portions in native code. Visual C++ .NET 2003 performs several new optimizations on native code, which further increases performance. What's next? In this article, we have looked at some of the reasons why one may want to use Managed C++ (or not). Then we looked at what the Managed Extensions are. From there, we wrote our first MC++ program. I hope that I have at least interested you. In the next article of the series, we will look at the powerful facility of IJW (It Just Works) and how we can take existing unmanaged C++ code and compile and run it within the managed environment, without modification! The last article will focus on mixing managed and unmanaged code together. |
. With respect to papal infallibility, Catholics believe that ecumenical councils of bishops and the pope are immune from error when speaking ex cathedra about faith and morals (i.e., "from the chair" -- by sole virtue of position or the exercise of an office). (And by "infallible," Catholics mean much more than merely a simple, de facto absence of error -- it is positive perfection, ruling out the possibility of error. For more on infallibility, see notes on Vatican II below). In actuality, Roman Catholicism places itself above Scripture; i.e., it teaches that the Roman Catholic Church produced the Bible and that the pope is Christ's vicar on earth. Catholics also maintain the belief in sacerdotalism -- that an ordained Catholic priest has the power to forgive sins (cf. 1 Tim. 2:5).
: