ITT: phrases a C programmer would never say

ITT: phrases a C programmer would never say

Other urls found in this thread:

quakejs.com/
lomont.org/Math/Papers/2003/InvSqrt.pdf
en.wikipedia.org/wiki/Newton's_method
developer.mozilla.org/en/JavaScript_typed_arrays
en.wikipedia.org/wiki/Fast_inverse_square_root
github.com/python/cpython/blob/master/Modules/gcmodule.c
twitter.com/NSFWRedditImage

I have a girlfriend

/thread

Hey Sanjay check out this functional and secure code I just committed.

Maybe I should use immutable types.

Please use Rust.

Go sucks

fpbp

I don't get paid enough

i forgot to free dat pointer

c is an old byte processing language without templates, exceptions, namespaces, constructors/destructors (and therefore RAII), virtual function polymorphism, references, operator/function overloading, reusable standard generic containers, or explicitly named casts

...

Hey, we should write an OS in Javascript!

I'm no longer looking for a job.

/thread
But to be fair, only javascript programmers would think this was a good idea. Pretty much every programmer who works with other languages know the usefulness of C/C++/ASM.

You literally can't even write Q_rsqrt() in Javascript.

This code does not have any UAFs

wtf is a UAF?

Use after free.

You're new to programming? then you should start out with a programming language that's a bit easier for you to understand.

I enjoy shitting in a toilet.

"Sure boss it can be done by today"

Guys, what about the UX?

i should make sure this int doesn't overflow

Wow! I'm really amazed by how lightning fast Python is!

this is not "things no developer said ever"

I didn't suck any cock today.

As a retarded programmer who can't into basic data structures and their algorithms, I'm constantly amazed at how fast set, list, and dictionary operations are in Python.

Now, implement something that must solve a differential equation for all pixels of a 500*500 matrix, and compare the speed with what you get in C using the exact same algorithms (even without paralleling). That's exactly what I did today.

Python: 8 hours (estimated, didn't even finish)
C without paralleling: 15 minutes
C with pthread (6 threads): 3' 20

scipy/numba

I'll design the logo. In Assembly.

Being able to show off my one line fizz buzz solution on Sup Forums is more important than creating well made programs

/thread

I know how many items are in this array.

underrated comment

I'm switching to java.

Are written in C

?

You can work around references with pointers

Traps are disgusting

Now do it with an array of strings.

won't work if you pass arr to a function

checked

okay

true

?

Well when you get right down to it, probably most things are ultimately in C.

Indeed they are.

Look, we both know that was a shitty hack that should never had made it to production. Even the comments in the code say wtf. It's code like that that's holding us back. JavaScript can do a square root properly.

>never had made it to production
That's not true, it's not even Carmack's own invention. The only reason it says "WTF" is because he didn't write it himself and didn't understand it. Word on the street is that it's an old trick from SGI, who obviously had more experience with 3D graphics.
>JavaScript can do a square root properly.
These days it's not much of a gain, but back then it was like an order of magnitude faster.

Okay well let me know when somebody rewrites Quake in JavaScript.

>These days it's not much of a gain
Well it certainly does help to have dedicated instructions for things like that at the hardware level.

I know exactlty how and why this works

quakejs.com/

I poo in the loo.

quakejs.com/

you can work around everything with conditional mov instructions

Well, there's that, but also the proper square-root instructions are pretty fast. 7 cycles on Haswell+, I believe. Reciprocals are still pretty slow, though, so without rsqrtss, Q_rsqrt might actually still be faster.

Emscripten doesn't count.

To go back a bit in the reply chain, though, there's no way to utilize those in JS.

fpbp

I'm shaving my beard.

My life is easy.

I write secure programs.

I'm still waiting for it to load.

I Love Rust. Webdev is real programming.

>I write secure programs.
But that's what they all say... "If you're good you don't make mistakes", that's what I've learned from the Sup Forums C experts.

I am not taking care of someone else's child.

Kek

Swear fealty to the anime and embrace the anime era, it will come soon.

Are you a C programmer, what do you program in C?

Python itself is written in C
So is Ruby

what a bunch of gay fonts

>I'm so happy I can work on fun projects instead of writing code for shitty microwaves in a shitty proprietary ide or making contributions to linux kernel that linus won't accept anyway

Just use malloc

I wish I could use a shitty non-compiled language that is at least five times slower than C to do this in a just a tiny bit simpler way

there is literally nothing wrong with malloc, unless your a retard

void function(int* s){
..
..
delete s;
}
void main(){
int* p = (int*)malloc(sizeof(int));
function(p);
..
..
printf("No. of black gf my wife had: %d\n",*p);
}

free(s);

Corrected

Meanwhile a pajeet is doing
#define NO_OF_BLACK_GF_MY_WIFE_HAD 0
void function(std::shared_ptr s){
..
..
std::cout

fpbp

I don't need to look at the man page for this library function.

Oh no, a whole five times slower! C programmers have no sense of scale indeed. I've found most of them to be innumerate.

I'll let garbage collection deal with this mess.

Python is great for automating menial tasks, for more complicated stuff I'd recommend creating a module in cython that contains the most intensive tasks and the rest can be done in regular python

Fun side projects such as emulators and libraries.

/**
* References:
* [1] ftp://ftp.idsoftware.com/idstuff/source/quake3-1.32b-source.zip
* [2] lomont.org/Math/Papers/2003/InvSqrt.pdf
* [3] en.wikipedia.org/wiki/Newton's_method
* [4] developer.mozilla.org/en/JavaScript_typed_arrays
* [5] en.wikipedia.org/wiki/Fast_inverse_square_root
*/

const QUAKEx32 = 0x5f3759df
const x32 = 0x5f375a86
const x64 = 0x5fe6eb50c7aa19f9

/**
* Appearing in the Quake III Arena source code[1],
* this strange algorithm uses integer operations
* along with a 'magic number' to calculate floating point
* approximation values of inverse square roots[5].
*
* @param {Number} n Number
* @param {Number} p = 1 Number of iterations for performing Newton's method[3]
* @return {Number} Result
*/
function fisqrt( n, p ) {

p = p || 1

fisqrt.y[0] = n
fisqrt.i[0] = 0x5f375a86 - ( fisqrt.i[0] >> 1 )

while( p-- ) {
fisqrt.y[0] = fisqrt.y[0] * ( 1.5 * ( ( n * 0.5 ) * fisqrt.y[0] * fisqrt.y[0] ) )
}

return fisqrt.y[0]

}

fisqrt.y = new Float32Array( 1 )
fisqrt.i = new Int32Array( fisqrt.y.buffer )

console.log(fisqrt(9, 2))

BlueJ fucked up my classpaths

github.com/python/cpython/blob/master/Modules/gcmodule.c

>side projects
Ok

Semicolons are fine

Maybe I should double check that free().

You know the JIT compiler is just as fast, and I get to write in my favorite language, Scala. That's twice the productivity!

>It is more important that a program works correctly than it running 1% faster
>The programming language is a tool designed to help humans, so it should help you find and avoid mistakes
>My programs all work with UTF-8.
>This API feels nice and natural to use. Everything is self-documenting.
>It feels nice to have a standard library you can rely on that has what you typically need.
> I am able to implement and use data structures that are more complicated than linked lists. (That's exclusive to Sup Forums C-programmers, others can do it.)

> bruh just log the JSON to the console

savage

OOP was a good idea

in embedded applications execution speed and execution predictability is important
of course a scriptkiddie wouldnt understand

>c
>predictable
no

Sure, I'll use a sane build system, valgrind, statical analyzers, -Wall + -Wextra and other QA tools right from the start.

/thread pretty much

Pretty sure shawn mcgrath said something like this in the second programming talk he did with sean b, its on youtube but like 3h long

- Windows is good platform for development and security.
- Done!
- Hello darling, I come back from running, what's about sex shower?

If we are talking about embedded computers then there is a lot less undefined behavior because there is no memory protection or OS to worry about