/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

github.com/enfiskutensykkel/ssd-gpu-dma/blob/new-build/samples/identify/no_module.c
en.wikipedia.org/wiki/Return_value_optimization
en.wikipedia.org/wiki/Copy_elision
twitter.com/SFWRedditImages

Value types do not belong on Java.
Whether an identifier is reference or a value should be implicit in its usage (as in C) or at least in its declaration (as in C++)

True, but it makes for some great optimizations.

I don't think you understand. Friendly reminder that you should return reference to an object iff:
1. The object itself is passed to the scope as a non-const reference
2. If the object is created within the function scope, it is static
3. In no other situation

Reminder that you don't also need multi-return functions, create the expected values first and pass them as non-cost references into the function. These are called out params.

A monad tutorial. It's the third one I'm writing this year.

We need more monad tutorials.

One of the advantages of Java over similar languages like C# is the clarity and lack of mental overhead that its simplicity brings.
I don't mind writing .equals everywhere because it remains obvious that .equals always means value equality and == always means reference equality. With C# where overloading == is a possibility, all bets are off. Even an assignment operation could mean something different depending on whether it's a reference of value type.

What's that pic about? Finding the girl?

>One of the advantages of Java over similar languages like C# is the clarity and lack of mental overhead that its simplicity brings.
I see you've never had to mix arrays with generics or nested type parameters with co(ntra)variant types.

>Otoko no (danshi?) wa kono naka ni iru
>There is a dude here.

The lack of value types actually adds extra mental overhead. You can do this int[] numbers, but not List numbers. Also List adds extra indirection which is bad for performance.
Kotlin has a better solution for the developer: the `Int` type. It behaves like `Integer`, but the compiler may optimize it to a primitive.

ALL of them are dudes, my dude.

Valgrind a useless SHIT!

got an answer? this determines your employment in

>What are you working on, Sup Forums?
Made an example program using my library but without requiring any low-level interfaces for mapping physical pages.

Only works with an IOMMU disabled though, so the plan for the rest of today and tomorrow is to make a kernel module that pins pages and sets up IOMMU domains properly as a fallback solution if you don't have the cluster software stack installed.

github.com/enfiskutensykkel/ssd-gpu-dma/blob/new-build/samples/identify/no_module.c

>physishit

it says "someone here is a trap!!"

it's a quantum computing book

idk like 2 or something

When I call glUseProgram will OpenGL just be smart enough not to rebind the program if the consecutive calls have the same program ID or should I keep track of it myself and make sure I don't call glUseProgram with the same program ID to avoid performance penalties?

>char* colon

What about it?

You have to know what you're talking about to criticize the actual content of the code, but style is something any dipshit can talk shit about.

>be pajeet
>mentions colon in code
Poo in loo

I've been programming for a few years now, but I want to start getting paid for it without
>doing gui
>doing web design
>touching sql or anything like it
>a degree
>any professional experience

is it a pipe dream?

see

>quantum computing
the fusion of computing
never happen
but it's a nice area to wank it in academia

UX/GUI stuff and web front-end is pretty entry level stuff, which means that it is the easiest to convince an employer that you can do without having a degree or experience (it's very visible work, so you can always refer to personal projects and portfolios).

If you want to do other types of programming, then that's going to be harder without a degree.

integer i is the nth element of arr
integer is is arr's nth element
since it's just syntactic sugar for int i = *(arr+n), and #2 is closer, #1 is retarded

>but it's a nice area to wank it in academia
Much better than cybersecurity, that's for sure.

Freelance for a bit. Fluff up your personal projects and show them off on a portfolio website. Try to avoid actually stating that you don't have professional experience (but don't lie if directly asked). Use phrases like "worked with" or "used". Focus on your results and not your techniques.

You will probably have to start off with those less glamorous types of project (websites, apps). Later, with that work experience under your belt and demonstrated knowledge of deeper technical aspects via your personal projects, you could start approaching potential employers closer to your desired field.

I'm also degreeless and currently freelancing building webapps and some iOS stuff. I suggest taking what you can get until you have enough experience to bargain with.

that's what you think, kid

otoko no ko is the first bit,
男の娘
means trap but sounds like
男の子
so it's a play on words. all the characters shown are traps.

Take trapshit to Sup Forums will you?

Oh i see, so both kanjis are read in same way, thanks m8!

>learning Japanese because >lol anime
>meanwhile Japanese people despise foreigners and weeabos

kill yourselves

Which cross platform utility(data structures, string encoding, directory handling, threads and stuff) library to use with C?
Glib(bloated)
qlibc
tbox
klib(covers only data structures... so not enough)
apr
libmowgli2(suggested by suckless)
something else what?

it's already happening

so you mean that if I pass a string by value it won't go through the copy constructor ?

C++17

fuck off dumb sepplesfag

cout

en.wikipedia.org/wiki/Return_value_optimization

I'm gessing pos and n are integers

There's no reason not to use C++ if you want C with handholding.

oh, you meant as return value
that makes more sense

Integer division in C truncates.

Do they have to be floats for cout to output the proper format?

Can someone give me the rundown for good practice with complex header inclusion structures in C?

year 1: introduction to programming, data structures
year 2: algorithms, computer architecture
year 3: operating systems, compilers
year 4: artificial intelligence, quantum computing

refute this

well they have to be floats (or doubles) for the operation result to be correct

No, I gave you the wrong link. Sorry.

en.wikipedia.org/wiki/Copy_elision

Use forward declarations, limit the number of symbols you expose in the global scope, chain includes to the minimum so you don't ignore missing includes.

No there isn't dumbfuck.
You should be able to make programming with the low level easy. The need to use libraries is universal.
You should not force name mangling, unstable ABI and the cluster fuck that sepples is to people.
Fucking retard.
> C with handholding
I have implemented all of the features myself except string encoding which is quite trivial if you limit yourself to ascii and utf8. There's still benefit in relying on libraries in bigger projects.

>You should be able to make programming with the low level easy.
That's why C++ exists and is a clear upgrade over C. There's no reason to use C.

>You should not force name mangling, unstable ABI and the cluster fuck that sepples is to people.
dumbfuck

>extern "C" does not exist

C++ is hazardous, other C++ programmers especially. There's no downside on personal projects, but you're fucked on any team project.

>HURR EVERYTHING I WRITE IS IN THE GLOBAL SCOPE SO THAT OTHER PEOPLE CAN LINK TO EVERY SINGLE FUNCTION DURR

You're probably the kind of C programmer that refuse to use the static keyword in function declarations, overuses typedefs and prefers #define constants, aren't you?

t. somebody who has never programmed in sepples and never had to use extern "C"

thanks user, I learnt something today
what would be the advantage of this over const reference (beside the shortened syntax)?

I have an issue:

Header A is included by B and C, and header B is included by C.

I have forward declarations in B and C for a struct typedef in A, but it seems that C is screwing up somehow because it claims the struct typedef has none of the members it has.

>and prefers #define constants,
const isn't really constant and enum is restricted to ints. #define constants are the least insane option.

I'm not the original guy so my opinion is that you shouldn't.

the Bachelor in my college is like this

year 1:
>introduction to programming (python)
>computer architecture
>logic
>algebra
>c programming
>physics
>statistics

year 2:
>algorithms,
>networks
>data structures
>operating systems
>OOP programming
>information theory
>data analysis (fast Fourier transforms,...)
>simulation

year 3:
>compilers
>artificial intelligence
>computer graphics
>databases
>software engineering
>distributed systems
>advanced data structures

figure out how your code got to be circular in the first place and uncircularize it

>const isn't really constant and enum is restricted to ints
C++ doesn't have this problem with const correctness and enum class.

/thread

Why would anybody refuse to use static in C?
>prefers #define constants
I prefer enums and constant variables that when needed for creating FFI from other languages.

>no QC
enjoy the unemployment line in 2 years

>QC
?

faster executables since there's no memory access, i'd presume

>Why would anybody refuse to use static in C?
The same kind of person that cares about "stable ABIs" for his standalone FizzBuzz program.

Which is why I use const for constants in C++. There's no good option for constants in C.

Rust or C++?

quantum computing

If those are your only options, C++.

Thank you, Boobs.

we learn that in physics though.

see pic

>Boobs
Sorry, left over name from last night, when some CNN anchor fake-freaked out when someone had the balls to say "Boobs" live on TV.

b-b-but rust is the future, desu!!

Yeah, but currently it's an unstable mess.

...

ist? laughing at your useless physics

You are writing in C so you are already avoiding lot of overhead that comes from using more dynamic language.
Personally I prefer runtime variables over compile time. Of course when dealing with embedded devices there's reason to do as much as you can compile time and avoid using memory because the devices have like 8k ram or even lower sometimes. Then again when dealing with embedded systems you usually don't even get fully standard confirming C compiler so you can't really use any desktop libraries anyways so I think it's fine to be a little wasteful when writing desktop C libraries.

>quantum computing

year 4: quantum & analog computing

because both are equally useless

ist?

we learn that in a informatics engeneering course, but no once uses that once they found jobs. just to look like a modern course

How does mergesort work?

What about D(ick)?

what is google?

Instituto Superior de Tecnologia

either that or FEUP, I can't see any other university wasting their time teaching QC to undergrads

>enjoy the unemployment line in 2 years
>implying businesses will switch to quantum computers this fast
>implying they will be cheap in 2 years

i'm on FCTUC

*Técnico

Say you have four already sorted lists of integers, in ascending order. In order to make one large sorted list out of those four, you make a loop that always take the smallest element from the top of one of those lists. Repeat until all lists are empty, and you are left with a large sorted list.

Now imagine if this process is repeated, so you start out with 100 lists of only two elements each. And then you continuously make larger lists.

Holy shit, destroyed. How can Pluslets even compete?

I googled, but I still don't understand.

No significant adoption or increase in community the last 15-20 years, so pretty dead.

o técnico é a melhor universidade?

A few question from a C# newbie:

1. What else can be used instead of 'static' when you define a method?

2. Is the 'main' method compulsory in every class you define or in one program only?

3. In a line static void Main(string[] args) what does 'string[] args' mean and what can it be replaced with?

>2
You only need one across all your classes, that's where your program begins.
>3
An array of strings named args. When you're running it from the command line, that's where your arguments will be accessible. You can leave it empty instead of you like.