comp-sci
Discord ID: 423219052849397773
17,577 total messages. Viewing 100 per page.
Prev |
Page 3/176
| Next
Programmers that never looked at any library, any API, don't know what the usual names of things are.
Then they shove a bunch of generic names everywhere with no meaning.
It's interesting to see, after you go through a lot of bad code, how important having a shared vocabulary is.
I worked on a project where a `Connection` object was actually a tuple, and had one method, named `cleanup()` that manipulated data in another class.
And the class that would usually be called a `Connection`, with methods analogous to `send()` and `receive()` was called `Interaction`.
Of course, the methods weren't called that, they were called `push()` and `process()`.
push()
It was almost as if every name of class and method was created to mislead anyone else working with the code.
So yeah, don't be "that guy" that doesn't know the name of things that everyone else knows.
You should be curious to do things on your own without needing somebody to hold your hand, but also you should constantly check what other people created, to make sure you're not doing things completely wrong.
How did you mark up the text?
Google "Discord markdown".
That took all too long
Covered out the `http://localhost`?
Its my public ip
Share it
Also, chrome? Really?
Might as well just use JS
What do you use? Safari?
One has to wonder, how much energy we're wasting worldwide because so many websites now offset computation and rendering to the client side.
@Durtle02 Use firefox
@Deleted User This is my life tonight.
```
.data
print: .asciz "%d\n\000"
scan: .asciz "%d\000"
.comm A, 32, 32
.comm B, 32, 32
.text
addr_A: .word A
addr_B: .word B
addr_scan: .word scan
addr_print: .word print
.global main
main:
stmfd sp!, {r0-r1, lr}
ldr r0, addr_scan /* r0 <- &addr_scan */
ldr r1, addr_A /* r1 <- addr_A */
bl scanf /* calls scanf */
ldr r0, addr_scan /* r0 <- &addr_scan */
ldr r1, addr_B /* r1 <- addr_B */
bl scanf /* calls scanf */
ldr r0, addr_A /* r0 <- addr_A */
ldr r0, [r0] /* r0 <- *r0 */
ldr r1, addr_B /* r1 <- addr_B */
ldr r1, [r1] /* r1 <- *r1 */
cmp r0, r1 /* compare r0 and r1 */
movgt r1, r0 /* move greater to r1 */
ldr r0, addr_print /* */
bl printf /* calls printf */
ldmfd sp!, {r0-r1, pc}
```
@meratrix nigger is that assembly code
arm assembly my dude
why the fuck are you showing me that cancer
cause it's my cancer
two can play it that way nigger
``bl printf /* calls printf */`` comments could use more redundancy
I guess it's useful for people not familiar with the mnemonics.
But then, `cmp r0, r1 /* compare r0 and r1 */` ? That's just retarded.
Gotta comment every line otherwise TA's give me shit
they should be more worried the students know what their code means
Back when I did assembly homework, I had to normalize a single-precision floating point number on a toy computer, that had only 256 bytes of RAM. And we had to write our own assembler.
i'm learning 68k but im gonna learn ARM after that
And whoever used the least instructions got bragging rights.
which computer
Oh, one that my professors used, I think it was created by a student a few years prior. Don't even remember the name.
It was your typical two operand instructions, 4-bit instructions.
interesting strategy. too obscure to cheat?
I guess so.
can i do your same assignment on 68k?
I don't see why not.
will it be easier then?
Probably.
I got bragging rights, by the way. Got my program to be even shorter than the professor's and the TAs' programs.
By using the instructions themselves as constants.
About 20% of the class couldn't make it fit in the 256 bytes.
what book did they give you for assembly
assembly is cancer
^you probly like java
^likes js
Another we had to do was long division. Actually, now that I'm thinking about it, the 4-bit instructions one was to program long division. The architecture didn't have division. The normalization one was on an 8-bit instructions architecture. Same 256 bytes limit for both.
well you've already said assembly is cancer twice. yet your computer needs it to run, js or no?
We didn't get any book, the course was on computer architectures. We went through the design of various didactic architectures, then at the end some MIPS and IA-32.
if i wanna play with ARM i should buy an rPi??
There are plenty of ARM devices.
yeah but its mainstream, deployable, versatile, so it's a good starting point?
yee
By all means, learn some assembly, it'll do you some good. But you don't really write programs in assembly; at least not if you want to finish coding it any time soon.
Mainstream? Go for x86-64.
You should know what compiled code looks like, specially if you want to have any hope of debugging code properly.
Say, what a function call looks like.
What an array access looks like.
What a C string operation looks like.
What an `if` or a `for` look like.
But you don't really write any significant code in assembly. We have compilers for that; at which point the architecture is irrelevant - as long as the language is supported by the hardware vendor.
well i thought ARM asm was big for embedded systems
Dude, even NES games were made with compilers (or pseudo-compilers) back then.
Embedded devices these days have plenty of RAM and CPU.
When you program something for a raspberry pi, you do it in a high level language.
well what do arm asm dudes get paid for?
Usually people just run Linux on a raspberry pi, and thus they can use any language that runs on Linux + ARM.
also, as far as my reasearch i was under the impression that all or most 8/16bit console games were coded in assembly. But as I'm learning I see it's all about sweettalking the Assembler with macros to let you write human-readable code
What would often happen is, some essential routines would be written in ASM, and they would be glued with an "almost high-level language."
sure like Doom used asm just for the column and span rendering
Back then compilers were bad at optimizing.
But they were perfectly fine for just calling routines that were written by hand in assembly.
I don't want to say that you don't need assembly, it's just that it's not for software development; you need to understand it if you're doing specific tasks for optimizations, for instance.
But you don't develop anything non-trivial in asm.
Takes too much time, and the compiler does a better job than you overall.
Even if you think the compiler can only do 90% of the optimizations you can do by hand... the compiler can work at 90% efficiency for the whole program, and never get tired, never make a mistake.
So even people that enjoy working in assembly, they first profile the program to know the hotspots, and only optimize by hand the few parts that will actually make a difference.
Even then, just because you think your code is better than the compiler's, doesn't mean it's actually faster.
I dodnt think i'd ever be good enough at it to compete with the compiler
This website is good, if you want to quickly play around with assembly output from various compilers.
Simple test with ARM assembly.
Try changing the `-Ox` argument to change the optimization level. Try `-Og`, `-O1`, `-O3`...
Note how the compiler understands that both formulas end with `/2`, so that part of the code is common and get folded into the same code, if optimization is enabled.
if I change -O0 it wont let me revert without reloading page
Really? Click the compiler output at the bottom, it should open the full compiler output to the right.
maybe it doesnt wanna play nice with Ublock Origin
With `-fverbose-asm`, although the editor already uses colors to indicate what ASM line corresponds to what C++ line.
cool. kinda demotiviating to see the comparison
the line correspondence is trippy here
This is x86-64, so it's using the MMX/SSE registers for the floating point.
Call convention allows the arguments to come in as registers instead of the stack.
xmm0, xmm1, xmm2
17,577 total messages. Viewing 100 per page.
Prev |
Page 3/176
| Next