Wikipedia:Reference desk/Archives/Computing/2014 September 7

= September 7 =

About c++
How c++ codes can work in computer as 01 is basic unit? — Preceding unsigned comment added by Amritphuyal (talk • contribs) 08:22, 7 September 2014 (UTC)


 * A compiler converts the high-level programming language (eg C++) into the computer's lower-level assembly language or machine code instructions that can be used by the CPU. I suggest reading those linked articles. (If you want to get down to the "real" zeros and ones, see Microcode.) Mitch Ames (talk) 09:13, 7 September 2014 (UTC)
 * If you can program, it may be instructive to write a small C program, and then tell the complier to stop after creating the assembler code, and inspect the generated code. On GCC the -S compiler option will do this, you'll need to check what it is for other compilers. There is a direct mapping between assembler and machine cod;, the former is for humans to read/write, the latter for the CPU to run. CS Miller (talk) 10:33, 7 September 2014 (UTC)


 * At the level of the circuitry, the computer uses binary - just 1's and 0's. But when we write numbers, we only use 0,1,2,3,4,5,6,7,8 and 9 - but that doesn't prevent us from writing pi as 3.1415926535 - and it's the same with the computer.  It represents numbers with 1's and 0's - but that can represent any number - so pi in binary is 11.0010010000111111011010101000100000.


 * OK - so the computer can store numbers. It can also do arithmetic on those numbers, move them from one memory location to another, test their values.  The clever part is that the instructions to tell it which of those things to do, and in what order - are also numbers.


 * So you could imagine a computer where 00000001 tells it to add two numbers together, 00000010 means "subtract", 00000011 means "multiply", 00000100 means "move" and so forth - we call these numbers "machine code instructions". We have instructions for a variety of arithmetic and logic operations - for moving numbers from one memory location to another, for testing whether two numbers are equal, or one is greater than the other and for fetching the next instruction from someplace other than the next location in memory (a "jump" instruction).  The list of available instructions can run anywhere from dozens to thousands depending on the sophistication of the computer...but in every case, each instruction has a number to represent it.  The electronics within the computer fetches an instruction from memory, throws switches based on the binary pattern in the instruction it's executing which causes that operation to be performed and decides which instruction should be fetched next.  The computer does this sequence of operations over and over for as long as it's turned on.


 * Ultimately then, a computer program is a long list of machine code instructions - represented as a long list of numbers - which in turn are represented as binary numbers inside the memory of the machine...just a very long string of 0's and 1's.


 * Writing programs using that binary code is incredibly tedious (but when I started out programming an Intel 4004 computer in my first job out of college - that's exactly what I did!) - so we've created ways to write things more comfortably than that. Initially, we'd write "ADD 10,23" and translate that into a string of binary digits that the computer can understand (in our example: 00000001 for 'ADD', 00001010 for '10' and 00010111 for '23'.  Doing that translation by hand is painful - so we write computer programs to do it for us.  Those more understandable representations are called Assembly Code or 'Assembler' - and the program that converts them into Machine code is called an 'assembler'.


 * But even then, writing in assembly code is kinda painful (I spend YEARS doing that...but very, very rarely have to do it these days). So by small stages, we've invented easier ways to write programs.  The early "FORTRAN" system translated arithmetic formulae like pythagoras' theorem: "h = sqrt(a*a+b*b)" into the necessary ADD and MULT assembly codes needed to evaluate that formula.  Converting FORTRAN code into Assembly code requires another piece of software called a "Compiler".  So FORTRAN=>Compiler=>AssemblyCode=>Assembler=>MachineCode=>0's & 1's.   Our simple description of pythagoras' theorem turns into binary numbers that the computer can understand.


 * C++ is a couple of generations on from FORTRAN - but the principle is the same. The C++ compiler figures out what low level assembly code instructions are needed to do what you want...and outputs a ".EXE" file (if you're running Windows) that has that ungodly long series of binary numbers in it.


 * When you're writing C++, it's hard to comprehend the complexity involved in having that turn into binary numbers - but that's exactly what's going on. The beauty of all of this is that 99.999% of the time, you can forget all that stuff and just write C++ or JavaScript or whatever.


 * SteveBaker (talk) 18:25, 7 September 2014 (UTC)
 * I haven't programmed assembler since time immemorial (for computers, that's 1989 ;-), but I still remember that 201 (hex C9) is the  instruction on the Zilog Z80. --Stephan Schulz (talk) 18:39, 7 September 2014 (UTC)


 * It could be worse. The PDP 11/20 we used in my final year of college had a particular sequence of instructions that had to be keyed in on the front panel to allow the boot loader to be pulled in from paper tape...I still remember that quite clearly. SteveBaker (talk) 23:02, 7 September 2014 (UTC)

Alternatively, you might ask how we humans can communicate here using computers, when "01 is the basic unit". Clearly, we're using a lot more than 0's and 1's here. But it's all translated to 0's and 1's "under the covers", just as with programming languages. "Hello" is actually 10010001100101110110011011001101111 "under the covers". How do I know? I looked it up in this chart. Over the past six or seven decades, we have devised various clever ways to isolate us mere humans from the 0's and 1's. &#8209;&#8209; Mandruss (talk) 06:39, 8 September 2014 (UTC)

fwupdate.exe
I have a Lenovo U310 laptop running Windows 8.1. Every time I log on, I am asked to let run a program called fwupdate.exe. I understand it is a legitimate LG program, but that it doesn't need to run every time I boot up. How can I stop it from running? --Halcatalyst (talk) 15:23, 7 September 2014 (UTC)
 * It is either in your startup folder (Start → all programs → Startup) or in the system configuration (Start → Search = msconfig). --  Gadget850talk 17:43, 7 September 2014 (UTC)

Can someone make me a neopets user lookup
I need one 65.175.250.157 (talk) 20:13, 7 September 2014 (UTC)