Originally posted by: itachi
Originally posted by: BingBongWongFooey
Yeah right. How many quoting styles are there in Perl? It's probably the most syntactically-complex popular language around.
exactly how do all those quoting styles differ? they're not all independent with their output.
1/3 as many projects as C or C++, that looks pretty prevalent to me. Do a search on any job site -- Perl is everywhere. It's the duct tape of the internet. If you magically made all Perl code disappear in an instant, the internet would probably completely fall apart.
1/3 still doesn't put it up there with C, C++, or Java.. and if you magically made all the vhdl/verilog code disappear in an instant, you'd have no video card, chipset, your cell phone would stop working, and all kinds of other sht.
1/3 isn't exactly down in the noise either. Perl is used alot.
Not at all? Then why do I have to tell it what size integer to use? Why does the size of a long depend on the machine?
that's C++ too buddy.. and longs aren't fully representable on any 32-bit machine.. it requires 2 registers to be used to do any alu uop. once you switch over to a 64-bit os.. the standard int is represented by the size of the largest accessible integer register, which would be 64-bits (rax/rbx/rcx/etc..).
AFAIK, int is *always* required to be 32 bits
Why do floating point numbers have a limited precision that differs depending on the machine?
what the heck does this have to do with anything?..
precision doesn't differ depending on the machine, it differs depending on the standard. almost all processors will implement the ieee standard floating point format- 1 sign bit 8 exponent bits and 23 significand bits for single precision. anything different from that is based on whether precision is more important or the size of the representable number (and this is available to C++ too)
Sorry, you're wrong.
On my platform for example, a long is identical to an int (32 bits), but long long is 64 bits. On an IRIX box int is still 32, but now long, and long long are both 64 bits. So you could be in for a nasty suprise if you depend on long being 64 bits on IRIX, then port to x86. Ask me how I know that!
In fact, only 32 bit values are required by the standard. So on some platforms, while a double type exists, it may be identical to a float. More commonly long double is actually a double, but the point is in C/C++ you have more control, but you also have to know what your hardware & environment support. Here's a hint - take a look at stdint.h and sys/types.h and get familiar with sizeof()
Anybody have some exotic platforms out there? What's the output of this program?
I used to have access to SGIs and Alphas, but not at the moment.
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(void)
{
cout << "char:\t\t" << sizeof(short) << endl;
cout << "short:\t\t" << sizeof(short) << endl;
cout << "int:\t\t" << sizeof(int) << endl;
cout << "long:\t\t" << sizeof(long) << endl;
cout << "long long:\t" << sizeof(long long) << endl;
cout << "float:\t\t" << sizeof(float) << endl;
cout << "double:\t\t" << sizeof(double) << endl;
cout << "long double:\t" << sizeof(long double) << endl;
return 0;
}
On mine (X86/Linux) its:
char: 2
short: 2
int: 4
long: 4
long long: 8
float: 4
double: 8
long double: 12
What's the register keyword for?
again.. what does this have to do with anything? straight C compilers are pretty much non-existant, they're all part of a C++ compiler..
Actually, I think you may have that backwards. At least historically, many C++ compilers were often frontends to transform C++ code into C. I know that the GCC has independent C and C++ frontends.
and i haven't heard of any recent compiler having such poor optimization that it would require the introduction of primitive heuristics. use the register keyword, and the compiler will ignore it unless you're using it for semantics other than optimization. and the register keyword is valid for both C and C++.
Sure, it's obviously less machine-specific than assembly, but it's not exactly independent from the hardware it's running on. The "high-level" moniker is what has been historically used, but in this day and age, C is pretty low-level, relatively.
wtf.. wasn't C++ the comparison? well, u haven't made any references to that.. instead you've been babbling on about irrelevant sht that applies to both C and C++.
The point is that, while it's nowhere close to assembly, you are much closer to platform specific things in a lower level language like C/C++
We haven't even talked about memory management, type casting, big/little endian etc.