/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1567870817741.jpg (2000x2000, 3.36M)

Other urls found in this thread:

pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
github.com/antirez/sds
github.com/facebook/folly
twitter.com/SFWRedditImages

I like C!

fn main() {
println!("Thank you for using an anime image!");
}

I want to impregnate Shamiko

Yes, I know you like doing fizzbuzz. Try having sex.

No you don't.

I also like C. I even write C for my job.

Attached: 1561867565250.jpg (900x1042, 275K)

I'm retarded.

I want this Python script here to create a wall of objects. There's an instance to generate horizontal rows, but I can't figure out how to make more than one row with the 2D array. I've been trying to figure this out for hours now and I'm about to have a mental breakdown.

What's going on, Jow Forums?

Attached: Capture.png (779x644, 31K)

i want to be a pink magical girl

I like C, too. I like this thread :)

>What's going on, Jow Forums?
I think you are retarded, sir. Consult the stack overflow, copy then paste.

I also write C for my job and I hate her.

Attached: 613646B4-3B5F-4563-ADF2-5BA10005FBB6.jpg (3167x4090, 1.79M)

>Consult the stack overflow,
Why do you think I'm here instead of stack overflow?

A sequence of genome that kills trannies

Because you are mistaken in the fact that Jow Forums is not your personal tech support,sir. Unless you pay one nine nine dot nine nine dollars for Jow Forums lifetime personal support for this computer. Do you see the windows key on your keyboard?

Attached: 1567864081772.png (487x421, 328K)

You're not funny.

Using some proprietary shit API is pretty niche. I doubt you'll find anyone here that can help.

>for i range
HAHAHAHAH

Not her but I sex my hand almost every day

Nice, that's dedication that I can see transitioning to a fruitful career. I wish you the best in life, user!

How do you remember all the intricacies of POSIX shell?
Every time I wanna use parameter expansion, I have to go back to the open group docs and copy paste the one I want because they all look the fucking same.
pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02

I'm not even gonna start with redirection operators.

Attached: e795e80fd91d5af6d3361e8bebbebcda.png (611x856, 349K)

have a photographic memory

I hate it!

1. don't learn more than one thing about shell a year
2. use a real programming language for anything you haven't learned yet

do you remember all of the intricacies of your main programming language's own standard library?
I certainly don't.

I just realised
else if
is
else
if

what about languages with elif?

Is number theory useful outside of number theory, like for combinatorics or lattices or something?

Attached: qq.jpg (400x323, 51K)

whitespace insensitive languages aren't kidding about it (er, and that's the wrong term)
often the only whitespace that matters at all is that between two identifiers.

yeah its pretty cool

whats elif

'elif' is python's abbreviation for 'else if'

It's kind of like "elf", it's cute. Python2 is so nice.

stop using python 2.

b'nah'

python2 forever

enjoy being left behind when the new year rolls around

b'Heh, see you nerds later then. Enjoy your walrus operator'.decode('UTF-8', ignore=True)

sorry, fucked it up. ascii strings can be so hard in python3
b'Heh, see you nerds later then. Enjoy your walrus operator'.decode('UTF-8', error='ignore')

>he'd rather use a slower, worse-designed, and more limited scripting language
>just because someone else already wrote some useful code in it

Attached: luaphase.jpg (1280x720, 58K)

>this shit
Python 3.7.4 (default, Jul 16 2019, 07:12:58)
[GCC 9.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> b'' == ''
False

python3 has wasted so many hours and days of debugging due to retarded UTF-8 strings. I really, really wish I could have a way to specify, that in my file, all strings are ascii. 0xff is 0xff not 0x1fff or whatever the fuck python3 wants to turn it into.

0xff is not valid ascii, though. So your file definitely is invalid.

What the fuck are you smoking.

How wide should tabs be for C?

thicc, at least 4 johnies, if not 8

ASCII is a 7-bit encoding, meaning the maximum valid value is 0x7f. All of that shit above that is "extended ASCII", which is just a giant fucking shitshow that has literally dozens of versions.

Anything other than 8 is heretical. That's like trying to define pi to be exactly 3.

Can you post a picture of your tits, sugar?

I'll take what is the foundation of cryptography for $100, Alex.

I remember the C library often times shits itself if your string is too long.

No it doesn't.

Anything else?

It's useful in other areas of pure mathematics that you will never understand.

github.com/antirez/sds

I would like to introduce you to gets and scanf.

Did you even read the rest of the post you retarded low energy room temperature IQ ctard boomer? Or did you fail to parse the rest of the sentence because you arbitrarily allocated char[100] and the rest of the post got lost in overflow? Fuck off.

Are there any examples of programming that don't involve computers?

>tfw using getchar and realloc to safely retrieve a string because C doesn't have real strings

Attached: 5D436482-2D72-457D-8C10-80C350454EA6.jpg (1260x1150, 143K)

Programming isn't really about computers.

The Jacquard loom was a mechanized textile loom programmed by punch cards, 1804.

Real strings don't exist.

What are you missing from null-terminated C strings?
Literally how hard is it to write a type and some associated functions in 30 seconds to allocate, concat, copy and retrieve SUPER DUUUUPER SAFEEEEEE C strings that rely on a LENGTH variable instead of NULL terminators??

>using getchar and realloc
man getline

gets was literally removed from the standard library. You're right about scanf's %s; you literally should never use that.

>#include
#include

int input(char *s,int length);

int main()
{
char *buffer;
size_t bufsize = 32;
size_t characters;

buffer = (char *)malloc(bufsize * sizeof(char));
if( buffer == NULL)
{
perror("Unable to allocate buffer");
exit(1);
}

printf("Type something: ");
characters = getline(&buffer,&bufsize,stdin);
printf("%zu characters were read.\n",characters);
printf("You typed: '%s'\n",buffer);

return(0);


>NOOOOOOOOOOOO, YOU CAN'T JUST... INPUT A STRING LARGER THAN 32 CHARS MY SPECIAL SNOWFLAKE C PROGRAM WILL BREAK

Attached: index.png (231x218, 8K)

Why yes I do love fast compilers so I use linear scan allocation.

Attached: 149F3D8A-E545-4F9E-8A94-49534C780E9D.jpg (831x1024, 82K)

Like what? Come on, I'm trying to get some motivation here.

RING RING U REARN MATH OR U NO BECORME DOCTOR, YOU NO BECOME DOCTOR YOU NO EAT OR SHITPOST

>Dude, electron is so bloat and slow, I want fast programs, what you mean that includes compilers? Fuck you bigot, I need muh inferred totality borrower. Every extra second spent compiling is worth every microsecond saved at runtime.

Attached: D6618522-3E04-4282-89E1-785F57053A84.png (192x239, 23K)

not helpful

I don't understand what the fuck your stupid retarded reddit man is supposed to mean here.
You're using getline in a stupid way, but is otherwise working as intended, and can easily read an arbitrary number of characters.

But seriously though, why can't we put more focus on compile time speed now since runtime performance isn't really an issue anymore? (and if it is just use compiler flags)

>runtime performance isn't really an issue anymore

Attached: 9a3a1cb8-ac99-445f-9377-9d4e275ec775.png (773x960, 410K)

Then you should use flags. No flags should default to fast compile time.

Why is python’s heap module so backwards? It’s been like this forever too, how has it not been fixed?

Writing a quadtree in C, does it make sense to declare the function for comparing two nodes to determine the relative quadrant of the child as static inline? I'm still getting to know how C inline, or any inline for that matter, works, and I kind of feel like that function may be used a little too dynamically to inline properly.

would hot reloading help?

Attached: 1563524296642.png (924x1333, 1.18M)

Go does that. Part of why it’s retarded is to make compilation really fast.

what is backwards about it?

Inline is largely irrelevant with link-time optimisation these days. Don't worry about it.

But C already has fast compile speeds AND runtime speed?

Attached: 1568171441562.jpg (585x552, 89K)

>runtime performance isn't really an issue anymore

Attached: 1554939578390.jpg (468x468, 193K)

Yes, because the C compiler is done right unlike rustc and ghc and seppletry.

Only if you’ve benchmarked that it actually improves performance.
First, the compiler is not obligated to inline a function even if you ask it, and it may inline one even if you don’t. Second, inlining will increase the size of a binary which can actually decrease performance.

1) its a collection of free functions you pass a heap to instead of methods you call on the heap. No other standard python container I’ve seen behaves like this.

2) the default implementation is a minheap, and no maxheap is provided. The canonical workaround for a maxheap is to negate your keys.

you can't inline a recursive function

what language?

Why the fuck are you creating a list called range then trying to call the range function in the next line wtfffff and it's 'for i in range' mein gott pure ideology

Rust, Haskell, sepples, and probably lots of other langs with terrible compile times too.

Lol all the major C compilers are written in C++

are there any interesting undocumented x86 instructions

That doesn't change the fact that sepples has shit compile times.

Attached: 90650998-4FC8-4A71-8DE3-A65D8CF6100C.jpg (1280x720, 92K)

read a book, nigger

Attached: langs.jpg (747x2143, 285K)

Mass literacy was a mistake

that's because C++ has glorious features like another programming language accidentally embedded in its syntax
greatness comes with a price

>replacing std::vector with folly::fbvector will improve the performance of your C++ code using vectors with common coding patterns.

why arent you using Facebook's C++ standard library yet, /dpt/? Its free and open source.
github.com/facebook/folly

It probably tracks your users

because i'm using EA's standard library

you can verify that it does not because the library is open source user.

working on a script to parse some configs

memes aside, i have mastered python and bash, what should be next, program in C++ or Rust?

Attached: c program.webm (360x640, 1.53M)