/dpt/ - Daily Programming Thread

C edition.

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

Attached: dpt.png (2000x2810, 155K)

Other urls found in this thread:

msdn.microsoft.com/en-us/magazine/mt814808.aspx/
stackoverflow.com/questions/6284553/using-an-array-as-needles-in-strpos
dipmat.univpm.it/~demeio/public/the_c_programming_language_2.pdf
github.com/germanoa/compiladores/blob/master/doc/ebook/The C Programming Language - 2nd Edition - Ritchie Kernighan.pdf
twitter.com/AnonBabble

I should be working on my CS dissertation but i'm too easily distracted right now
thank you for using an anime image

Attached: 1466969439649.png (653x568, 455K)

You cannot debate this.

Attached: 1503781260947.jpg (610x5332, 1.5M)

Anyone else struggle with pointers? I'm learning C++ and I can't wrap my head around them.

Attached: xngOuTW.jpg (560x560, 166K)

at some point it will simply click

return to C until you understand pointers and the heap

Should I have learned C first? IDK seems like a boomer lang. I just want to make video games

cant imagine learning c++ without being atleast familiar with C first

From what I understand it's just a way to point at the address of the value in memory. So if you have int a = 1; int b = 2; , *int a would returns 1 too(?) and *int a +1 would return either the b value (or its string of address, i forgot).

Am I correct?

Well I read most of the stuff C encourages you to do is bad practice in C++ so I'm not sure what the point is?

if you ever need to implement a vector or something you'll be writing c
at best you can just avoid ever doing anything without raii and explicit new, but you wont understand whats going on

>wolfram before matlab

Where i can get K&R latest ebook for free?

>I just want to make video games
You're doomed.

Nothing wrong with making games. He should be learning Rust though.

Since this meme template is ironic, the author meant to say that IRL it's the other way around, which I fully support except for JS being at the top.

why should i learn C if i could call ctypes from python ?

What do you not understand?

>CS dissertation
What's the topic?

don't want to say

What Linux distros do you guys use and what kind of development do you use it for?

I'm trying to make a super basic PHP help bot that looks at a string and matches a word in it with another sentence which it would get from a already made array. What would be the best approach? My array is in a file and I'm using the get method.

example: user types "need help with wifi" -> string comparison happens and wifi is matched with wifi in one of the sentences in the already made array -> returns the full sentence matched from the array.

sorry I'm bad at explaining things, im sure it's just a bunch of simple functions but i can't get my head around it. Would needle / haystack work here?

Debian for servers at work, Arch for playing with Rust at home.

>What Linux distros do you guys use
CentOS for servers, Ubuntu on my workstation.
(macOS at home)

>what kind of development do you use it for?
Mostly driver stuff in C.

Antergos, I do various shit.

msdn.microsoft.com/en-us/magazine/mt814808.aspx/
Wew, it's 2018 and MS reinvented slices.

here you go i hope it helps

Attached: pointers_basic.jpg (1704x5776, 1.22M)

are you looking for this?
stackoverflow.com/questions/6284553/using-an-array-as-needles-in-strpos

> int *x;
> This is a NULL pointer
This is bait.

I'm trying to write a Python project in VS2017 since I'm used to it (usually use C++), but intellisense just shits the bed constantly and gives me a half-working autocomplete at best.
Is there any better free Python IDE on wangblows?

Community version of PyCharm

Xubuntu on media laptop
Antergos with xfce for "work", clisp and school stuff

What are some cases where the output from GCC and Clang really differ?

first time working with sockets here;
whats the best way to identify individual messages received from a socket?

Where portability matters

Allocating local arrays (within the scope of a function). GCC will allocate the array on the stack as long as its smaller than a stack frame, Clang will prefer using a dedicated section for dynamic allocations.

*prefer using a dedicated section for dynamic allocations when the array exceeds 64 bytes.

TCP or UDP?
Because TCP does not preserve any message boundaries and just acts like a byte stream. Whatever the protocol sitting on top of TCP would need to add it's own markers for the beginning and end of a message.
UDP does have message boundaries, though, and you receive the packed in one go.

Can you show an example of this?

TCP at the moment, all via luasocket.
Having problems because socket:receive(*l) receives from the stream until it hits ascii 10 or 13.
I kind of need TCP because it's exact information, but it clashes with my messagepack serializer.

void foo()
{
char buffer[1024];
// do stuff with buffer here
}


GCC will most likely place this on the stack, Clang will most likely place this in a different memory section.

Are you sure about that? That wouldn't be thread safe

>doing cs
>required to take a subject on """""agile""""" development that's currently teaching us git and gradle
help

there's very little to get about how they work. you should instead think about their application. a pointer to an int is pretty much useless; there is no increase in efficiency. but pointing to an object of some sort provides a lot of efficiency in your program. after you understand that, it is a general rule that you will pretty much always use pass-by-pointer on structures (or in c++ pass by ref) when calling or creating functions. there are also some other useful properties, like polymorphism, that pointers facilitate, but you will learn that later

That's how pointers work

You're right, it only does this with
char buffer[32] = "I'm a long string";

when buffer isn't written to, only read from. When buffer is written to, it is allocated on the stack.
GCC always places it on the stack, however.

Guess it's some form of optimisation.

Trust me, those are the best courses precisely because you think you don't need them so you never read up on subject on your own.

>reading about type providers
neat

Attached: dumb frogposter 6.jpg (1000x800, 65K)

dumb frogposter

Does anyone have the pic with "Most popular programming questions at job inteviews"?
I'm teaching a kid to code C & C# (it's what his school teaches) and i want to make him do some practice, but the shit i can think of is either "sum x to y and print it" or "make a linked list and invert it", my mind can't find the middleground

Check out exercism.io, it contains a lot of small challenges.

How do you keep yourself from procrastinating all the free time you have? I'm full of ideas I would like to implement but the moment I'm free to actually do something I lost my motivation and just play vidya or watch youtube.

I don't
help me

Adderall

>Error message tells me a dependency is missing
>I add the dependency
>It just werks

I'm so confused, this isn't how it's supposed to be

No cheats.

So no caffeine, exercise, or anything that can improve your cognitive performance at all?

Weird thing to say

Reminder that OOP is utter shit which ruins everything it touches. OOPset OOPsies don't @ me

Qpython
>The privacy policy makes it seem like a botnet
>Made by Chinese, they don't even list qpython as their product on their own FB page
Pydroid
>Russian but with no website and no dev data

What do I do?

I just want to automate some stuff with my own python scripts.

@67260978
Make me.

It's actually the other way round for me - i need to find a needle in an array of haystacks. Then return the haystack that matched with the one needle. But thanks for providing that link.

OOPsies are to be thanked for their role in creating jobs. After all, why hire one competent programmer when you could hire five OOPsies instead?

So pointer is just a variable that is inputted the value of another variable address?

What exercise is good to stimulate my brain?

Yeah. The type of the pointer is the type of the variable at that address.

Pretty much any exercise will be good for your brain. The best exercise is the one you stick with and do several times a week.

so everyone is just going to ignore this

Jump rope while wearing your programmer outfit (a onesie is not a programmer outfit)

The response link is broken, do you seriously think I'm going to look that comment id manually?

meth. I'm not kidding it's fantastic

PyCharm for sure.
Jupyter Notebook too if you're into that sort of thing
those are both garbage. Qpython if you have to work on a phone

Meth wears down your brain with time though. At least at high doses.

>pure functional, static, lazy range lib
is this on github?

Does fapping count?

Rate this job that i saw a few minutes ago /dpt/

>>Key Responsibilities
>Work with Javascript (NodeJS in the backend, AngularJS and other technologies in the frontend) and MongoDB
>Create helper applications in C and Javascript
>Create and maintain a customized Linux OS
>Create and maintain Debian installation packages
>Build and hack the Linux Kernel
>Create bash scripts for several tasks automation
>Linux Systems administration

this is almost exactly what I do

Yes, fapping is good for your mental and physical health.

nice
how come?
maybe it's the same company

bump

what state?

>K&R
dipmat.univpm.it/~demeio/public/the_c_programming_language_2.pdf

github.com/germanoa/compiladores/blob/master/doc/ebook/The C Programming Language - 2nd Edition - Ritchie Kernighan.pdf

>inb4 company is looking for a replacement for user

>state
kek
it's in Southern Europe

my job is safe

ty

but the company is also in USA, London, etc
see you around

I fap every week. Why am I not a genius programmer yet?

>The /dpt/ daily programming thread
>The /daily programming thread/ daily programming thread
What did he mean by this?

kill you're a self

Don't question /dpt/ tradition

Attached: trop.png (1280x720, 1.07M)

You need to step it up to at least twice a day.

It's like wine: wine is not emulator

>Qpython if you have to work on a phone
Is there anything else for if I just want to run scripts (written on a computer?) or simply a python shell?

>Not using recursive three letter acronyms for literally everything

Are you even a programmer?

nevermind that, it works nicely. thanks again

Jira and similar tools are responsible for enabling an entire generation of mediocre middle management fuckwits to ruin companies

> be me
> programming an application
> pc shutdows down at times
> logs show that its because of a voltage brownout
> the power supply cant power everything that is connected to (lots of hardware)
> colleagues insist that its because of my program
> heavy finger pointing
> the project does not have a single line of kernel space code
> there is no one in the company besides me with the technical knowledge to understand this issue

Thats what I get for working in a startup made from uni grads.
At least today is my last day here lol

no :(

>if I change the priority on a ticket it means something

at least you have a job

That's pretty much my job too. This is the career path that Jow Forums prepares for you: a weird blend of Linux hacking and JavaScript.

Attached: 1518626495392.png (1000x669, 950K)