/dpt/ - Daily Programming Thread

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

Attached: 1537603076722.png (640x800, 378K)

Other urls found in this thread:

youtube.com/watch?v=WfIr7lKT4Sk
en.wikipedia.org/wiki/Translation_unit_(programming)
twitter.com/NSFWRedditImage

Attached: exfydw.jpg (854x480, 109K)

preparing myself for advent of code 2018.

Attached: shitposter.webm (1280x720, 2.83M)

dubs to ban anime
more on topic i ain't working on shit, just here in programming socks with no motivation or ideas baka

What's wrong with Ponylang?

that's an excellent pair of digits

Attached: 1494369549818.gif (469x200, 77K)

am I going blind or retarded? did I become dyslexic?

Attached: file.png (842x438, 36K)

>no asnwer

oh for fuck sake

>dubs to ban anime
Why are you even posting on this anime website then?

Attached: 1543221423073.jpg (720x960, 254K)

Stop.

Attached: 1447021850758.jpg (638x680, 143K)

i'm trying to make a bot. What's the best way for the bot to be running 24/7? I was thinking about buying a raspberry pi for that

restart it every 24 hours

rent a vps at ovh

Are you german?

AWS

4channel dot org is not an anime website

OVH has shit customer support, annoying deployment limitations and last time I used it their control panel broke and would not let me cancel a service. Use ScaleWay instead. It's cheaper to boot.

never had any problem with ovh

Are you looking to get banned again like the last guy?

I'm a completely newbie...

I have a solid notion of PC and stuff, I've programmed a little bit, but it was really amateur.

I want to understand computers in depth, so I'm reading Computer Systems...

but the preface of the book tells that anyone that doesn't know how to program to read C Programming Language, 2nd Edition before continuing to read Computer Systems... (at least that was what I understood).

Well... is it possible to go with Computer Systems without reading the C book?

People told me that the Computer Systems book would teach me how to program in C and at the same time would teach me to understand computers in depth...

So... what should I do?

Attached: 1543361363210.jpg (383x499, 25K)

Anyone has any idea what to make of this error? None of the code in the stack trace has anything to do with code in my DLL, I don't even know how to analyze it properly.

Attached: stack_trace.png (1510x322, 25K)

just go ahead and read the book, if it becomes apparent you have NFI what is going on, then google the bits that are stumping you or go and read the C book.

Which function prototype syntax do you like better?
fn name(type name, ...) -> ret;
fn name(type name, ...) ret;
fn ret name(type name, ...);
// Something else?

It has to use unambiguous grammar as to avoid vexing parse, which means no
ret name(type name, ...);

syntax.

Attached: 1538802994918.jpg (700x850, 49K)

he's right, actually. the front page of 4channel does say

"There are boards dedicated to a variety of topics, from Japanese animation and culture to videogames, music, and photography."

Jow Forums is dedicated to technology, not to anime. never forge that.

cheaters are faggots

YMMV

Vexing parse is just due to C++'s retardation.
It's not something that affects C, even though it uses that syntax.

Why does everyone think I am a cheater? There are tons of reasons for using DLL injection.

also get a copy of IDApro or radare

4channel as a whole is dedicated to anime.

nowhere such thing is stated in the rules/faq.

Jow Forums is dedicated to technology yes. But on every board it is acceptable to post anime as anime is part of the entire sites culture.
I'm in no way arguing that discussion of anime should be allowed on Jow Forums, I am simply saying that there's nothing wrong with posting anime images on Jow Forums alongside technology related posts, as people have always done.
Complaining about people doing so on Jow Forums(nel) is retarded and you should fuck off if you don't like it.

When people say Jow Forums(nel) is an anime website, they mean anime is deeply rooted in the culture, and it indeed is.

C has plenty of it's own grammar retardations.
Both C and C++ rely on language semantics to correctly parse some stuff.
youtube.com/watch?v=WfIr7lKT4Sk
And yes, vexing parse might be a concern for me because I want C++ style variable declaration (with a bit less retardation).
I want to stay close to C++ style syntax, but change it where necessary both for my own tastes and to keep the grammar LL(c) for constant c as small as possible and no reliance on semantics retardation.
A problem with C++ is it's unreasonably difficult to parse and it falls flat on it's face when semantic information is missing forcing you to use typename and template disambiguators. Fuck that ugliness.

>C has plenty of it's own grammar retardations.
The main one I can think of is the thing with casting
(a)*b
- Casting *b to a
- Multiplying a (which is in parenthesis) by b
Just come up with a different syntax for casting and you'll be fine.
Also the if-if-else thing.

>because I want C++ style variable declaration
Allowing () to be used to initialize a variable was a fucking terrible idea.
C++ is one of the shining examples of terrible syntax in both parsability and human readability. That is a terrible example and goal to aim for.

Attached: 1540868115908.png (3840x2160, 2.48M)

>Also the if-if-else thing.
Elaborate?
>Allowing () to be used to initialize a variable was a fucking terrible idea.
That's why I said with a bit less retardation.
I'm probably only going to support three declaration syntaxis:
type name; // default init, equiv to second with no params
type name{params...}; // direct init
type name = expr; // direct init, equiv to second with expr as param

Struct instantiation always done with {} to differentiate it from a call expression.

>C++ is one of the shining examples of terrible syntax in both parsability and human readability. That is a terrible example and goal to aim for.
I'm used to it and I like brace languages. But I agree a lot of the syntax could be improved a lot, which is what I'm doing. I'll definitely be changing template syntax for example.

>it has to be stated in the rurus
CoC sucker detected.

>Elaborate?
if (a) if (b) ... else ...
Which if does the else apply to?
if (a) {
if (b)
...
else
...
}
if (a) {
if (b)
...
} else {
...
}
There are both valid ways to interpret that.
They get around this by just saying that it's the first one, but that specifically needs to be handled in the parser.

>all Java traineeship don't require a degree
>all PHP traineeship requires a degree
Does anyone know why that is?

The if statement contains the next code until the semi-colon. In that example the next semi would be after the if which would contain everything until the next semi etc. It makes perfect sense for the inner if else to be contained in the outer if. The brackets simples create blocks of code that the if statement then contains.

Sure, it may make sense, but you want that sort of information to be expressed without any ambiguity in a context-free grammar alone.

That's why you use curly braces dummy. Any language can be abused to be confusing as heck. The reason you can leave out the braces is for single line statements. Complaining that you can't have complex if else nesting with it is stupid.

Just started transition from python to java. It hurts.

I fucking know. You just have to be very vigorous if you want to design a context-free grammar without ambiguity properly.
This formal type of shit requires a certain about of autismal attention to detail.

I think I was following a book called "oop with c". It was okay and interesting to see what you could do. I stopped partway through for reasons but I should get back to it some day.

name: (name: type, ...) -> ret;

dude just do K&R it's gonna take like a week if you do it fulltime.

Noob question here.
It's my 2nd CS year and I've written fair amount of small projects in C from scratch. But this time teacher provided us with half written program. All of his defined functions are static. I've never used static even for variables, let alone functions. I've tried to goodle but I just don't get the point of declaring static functions

Static in C for functions means it cannot be used outside of that file.

literally

Attached: k&r-static.png (925x1035, 364K)

But why? Is it in case of a big program with many C files so that function names don't conflict?

dude what you mean why? you have a module it has some inner functionality you dont wanna bloat scope with -> you declare it static.

Yes and also the function might for example only make sense if used in a certain way or in conjunction with some other function, so you don't want you colleagues to use it and introduce bugs into their code.

How about no.

regarding junior positions here in my country java and c# has same amount of job opportunities: I'm inclined to choose java, is that a good choice? also besides oop I want to start touching the surface of functional programming through clojure. as my focus is backend I feel like building a web app as a microservice in each language and make them interact with each other could be a good in order to learn properly, what you say /dpt/, am I in the right direction?

Larning the most popular language can hardly be a horrible choice.

fn name(name, ... : type) -> ret;

...

>Clojure
Avoid unless you're really, really autistic. I'm really autistic and I still snapped after a year of praying to Rich Hickey every night. There are some cool ideas in there, but so many weird quirks and idiosyncrasies that you just have to always be aware of that it ruins it. The tipping point for me was (set/union [1 2] #{2 3})) returning [1 2 2 3] because ofc that's what it does. At least a good statically-typed one would have either cast [1 2] to a set or errored but no. You just go waste your time trying to figure or why it doesn't just DWIM. Maybe clojure.spec coulda alleviated that, but that's not nearly the only pain point I assure you. Just go with Scala: even the generative testing bit is better.

Attached: go.jpg (1600x878, 48K)

>score based on first to solve
fuck i hate that

Same. It's encouraging people to put some trash together in python and call it a day.

exactly. it basically favors python users, as well as people that have libraries and macros set up for these types of challenges

that's the point of a challenge: to resolve a problem the fastest possible.

Horrible.

name: type -> type -> type
name x y z = ...

stop blaming programming languages for your own mediocrity. the guy who won AoC 2017 exclusively code in c++ and java.

That just proves my point. Java holds you hand almost as much as python. C++ is slightly better depending on if he used external libraries or not. The point of a challenge is your ability, not how well you can piece together others work.

>fastest possible
yeah depending on your timezone

>mediocrity
what if you're learning a new language through it?

i'm just saying that it's not the best metric, but then again it's the simplest and most feasible. whatever, it's supposed to be fun.

>what if you're learning a new language through it?
then do it for the fun, no one care. but don't blame people who do it competitively.

I've never made a scraper before, best I can tell I should learn libcurl and go from there. Is that the right track?

Attached: challenge.png (481x25, 6K)

>avoid unless you're really autistic
kek

I just had in mind learn an scripting language like python in order to build a web app to interact with another web app programmed in java in a microservice architecture like I said. I thought clojure would be a good choice since it's diff than java and a jvm language. I never thought of scala but since you suggest I may take a look at it. golang or elixir are what I'm also considering mainly cuz they are different than java which to me means I can learn something new
is this idea of building 2 different web apps in 2 different languages and make them interact with other good to learn or should I just learn java frameworks like spring boot or vert.x and build web apps using only this lang?

My wife Yuki is so cute

but i want stars, dammit! :^)

tell me what is the point of extern functions in >= c99

extern has been there from the start. For nonstatic function declarations without definitions, it's implicit.
extern inline was added in C99, is that what you mean?

Attached: 1542083082815.png (625x773, 126K)

no just extern, it is implicit then

declare module public interface

By that logic learning JavaScript and PHP are stellar life choices.

c doesn't have modules

>c doesn't have modules

Attached: EXPLAIN.png (1500x556, 57K)

c only knows about translation units
there's no module system

for the compiler then linker goes in and it's a module, am i missing something?

Attached: brainlet.png (478x523, 14K)

when people talk about "modules" as a feature they're usually talking about some kind of implicitly generated binary interface that the compiler can use to figure out what's in a particular translation unit
C doesn't have these which is why you must use headers

aight i've jsut read this
en.wikipedia.org/wiki/Translation_unit_(programming)
got you

The worst.

Object files are really really shitty modules.

Modules shouldn't be anything more than serialized ASTs.

Is a writeback cache always preferable to a writethrough cache?

Nah, that's hardly any different to a normal source file.

Doing anything more will just become wasteful if your language has code generation features or has a lot to gain from interprocedural optimization, which is most of them.

So then explain why dumping your AST in a module is any better than just pasting the raw source code in a namespace?
Other than compile times of course.

in theory since going deeper on every write is like defeating the whole purpose, disclaimer i've just finished computer architecture class

There isn't one. There's a reason scripting languages do that.

>do a glorified data entry job after my lectures
>have to type in values from a pdf file into the entry fields of a program
>in my empty time write a simple excel macro that takes the text and formats it into an excel table
>turns it into a simple copy-paste, that's 500 times faster than doing it normally
>realize if I used this or gave it to my coworkers it would make 80% of my work obsolete, thus I'd be doing nothing all day, resulting in me probably getting fired
>delete the macro and keep doing everything by hand
>mfw

Attached: 1535923562173.jpg (591x716, 28K)

retard

Use the macro yourself and pretend to do work for the rest of the day while browsing /dpt/.

Attached: 1424659044558.png (417x417, 120K)

user you're gonna have to make the call on if they think you're valuable to keep around when you're able to replace yourself.
They did hire you to begin with. They didn't just write the macro themselves.

If you're unsure you could just keep doing it this way and ask for more to do. It wouldn't be too far fetched for a university student to think that what your doing now is the actual work.

What are Jow Forums's thoughts on Xamarin? I need to make an Android app and am trying to decide what to use. I already know C#, Java sucks, and I'm not sure it's worth learn Kotlin just for android. Xamarin also works on ios. But I hardly see any projects using it. What do?

Or you could do it using an existing scraping library. Was the goal to write a web scraper or image downloader?

First one is alright.
But consider what generic programming features will be in the language and if this influences the choice. You don't want to be sepples.