Contradiction: they ARE algorithmic optimisations. Ergo they are AS GOOD AS.bzt wrote:@dozniak: what I meant constant folding and constant propagation and liveness analysis never will be as good as algorithmic optimalization.
Why do people say C is better than Assembly?
Re: Why do people say C is better than Assembly?
Learn to read.
Re: Why do people say C is better than Assembly?
https://en.wikipedia.org/wiki/Delay_slotbzt wrote:@Octocontrabass: could be! According to the wiki, DEC have used MIPS. I really don't remember, I can only recall my "wtf is happening here?!?" moment
MIPS and SPARC are probably the most prominent users of these.
Learn to read.
Re: Why do people say C is better than Assembly?
This is either wrong or irrelevant depending on how you define 'smarter'.bzt wrote:I agree on all what you said, except this one. A human is always smarter than any compiler, .....
If a trainstation is where trains stop, what is a workstation ?
Re: Why do people say C is better than Assembly?
Another way to say that C is good is that in Assembly you can't use numbers as large as... 1.7x10^308.
- dchapiesky
- Member
- Posts: 204
- Joined: Sun Dec 25, 2016 1:54 am
- Libera.chat IRC: dchapiesky
Re: Why do people say C is better than Assembly?
To expand upon this statement I think the reason we have so many different languages is the that we have so many different problem contexts.... a simple example being:Schol-R-LEA wrote: Well, that's the thing, you really can't - I mean, you can learn to read it to some degree, just from the similarities it has to other procedural languages if nothing else, but without practice at writing C code, you'll never really get a feel for the language. So in that sense, yes, you would need to write a significant amount of C code before you could read it well.
1) geometry
2) topography
3) algebra
4) calculus
each involves math but each has a different nomenclature for describing problems within their respective contexts.
So if your problem context is controlling hardware in a very specific fashion - perhaps a programmer would feel more comfortable thinking about solving the problem in assembler.
If a programmer were not versed in assembler - they might still have a chance to solve the problem using C and absolute address pointers and in() and out()....
Yet said programmer could not attempt to solve the problem using a language such as PHP as it is directed at a completely different problem context - building web pages programmatically.
I have found that thinking about a problem and its solutions via different languages enlightening if only to find - hey you can't actually do that in C++ but you can in C because of less type checking... etc..
cheers
Plagiarize. Plagiarize. Let not one line escape thine eyes...
Techel
What does make you think this?DixiumOS wrote:Another way to say that C is good is that in Assembly you can't use numbers as large as... 1.7x10^308.
Re: Techel
floats, doubles...Techel wrote:What does make you think this?DixiumOS wrote:Another way to say that C is good is that in Assembly you can't use numbers as large as... 1.7x10^308.
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Why do people say C is better than Assembly?
Have you checked any assembler documentation for those, or are you just guessing?DixiumOS wrote:floats, doubles...
Re: Techel
And yet C translates into assembler. There's a paradox there somewhere.DixiumOS wrote:Another way to say that C is good is that in Assembly you can't use numbers as large as... 1.7x10^308.
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Why do people say C is better than Assembly?
This clearly says you don't know how C works. Did you know that part of compiling your C file is converting it to assembly language and then assembling it? Literally, yes literally, anything that can be done in C can be done in assembly language, because assembly is just the mnemonic representation of the CPU's bytecode.DixiumOS wrote:floats, doubles...
Please, don't argue about topics you know nothing about. In a few years from now, you'll realize you've been humiliating yourself since you signed up for this forum.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Why do people say C is better than Assembly?
I meant that almost no one knows how to do floating point in Assembly.
Hint:
Hint:
Code: Select all
fld num1 ; load num1 and push it onto the fpu stack
fld num2 ; load num2 and push it onto the fpu stack
faddp ; pop two numbers, add them, push sum on the stack
fstp res ; pop sum from the stack and store it in res
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Why do people say C is better than Assembly?
Just because you don't know doesn't mean no one knows. BTW, using the FPU is deprecated and, by default, 64-bit applications utilize SSE.DixiumOS wrote:I meant that almost no one knows how to do floating point in Assembly.
Hint:Code: Select all
fld num1 ; load num1 and push it onto the fpu stack fld num2 ; load num2 and push it onto the fpu stack faddp ; pop two numbers, add them, push sum on the stack fstp res ; pop sum from the stack and store it in res
Code: Select all
; double precision (this is "double" type in C)
movapd xmm1, [num1]
movapd xmm2, [num2]
addpd xmm1, xmm2
; XMM1 contains result
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Why do people say C is better than Assembly?
Well, anyone who can cut and paste from stackoverflow "knows" how to do that. Whether they understand it or not is another matter.DixiumOS wrote:I meant that almost no one knows how to do floating point in Assembly.
Hint:Code: Select all
fld num1 ; load num1 and push it onto the fpu stack fld num2 ; load num2 and push it onto the fpu stack faddp ; pop two numbers, add them, push sum on the stack fstp res ; pop sum from the stack and store it in res
- bauen1
- Member
- Posts: 29
- Joined: Sun Dec 11, 2016 3:31 am
- Libera.chat IRC: bauen1
- Location: In your computer
- Contact:
Re: Why do people say C is better than Assembly?
Dixium 2 google searches later:
You got it from here:
http://stackoverflow.com/questions/1185 ... n-assembly
and this one even says its wrong:
http://stackoverflow.com/questions/3371 ... y/33716807
You got it from here:
http://stackoverflow.com/questions/1185 ... n-assembly
and this one even says its wrong:
http://stackoverflow.com/questions/3371 ... y/33716807
myunix (version 3) (name suggestions are welcome!)
GPG Key fingerprint: 5ED6 D826 ACD4 3F8E D9D4 FBB2 FF0A AF5E 0812 BA9C
GPG Key fingerprint: 5ED6 D826 ACD4 3F8E D9D4 FBB2 FF0A AF5E 0812 BA9C
Re: Why do people say C is better than Assembly?
Assembly is much better than C. so many people think C is fast these days... Assembly is like a few bytes. Imagine a boot sector in C. It would reach 1KB instead of 512 bytes.