/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

theregister.co.uk/2016/12/16/oracle_targets_java_users_non_compliance/
twitter.com/AnonBabble

first for fuck opengl

Anime

A systems programming language with features like type constructors, traits, lambdas, and dependent types. Not for safety, though, just code reuse.

doing a api in Flask, duno how I feel about it yet

ATS

I love Betty Boop

ATS is a mess. Note that by dependent types I do not mean interpreted as logical propositions. The only thing dependent about them is their size and alignment and how fields are laid out (e.g. for a struct containing an array whose size depends on a value).

What is this disgusting "language"?

Python.

How do I optimise code for my computer's hardware?

you using llvm?

>using filter and lambda when list comprehensions exist

code it with C and use architecture specific features like simd and stuff

-march=native

take some code
time it
look at the assembly
either rewrite the assembly manually, or rewrite the higher level code until the assembly looks optimized the way you want
time it again
not faster? put it back the way it was

From previous thread
Pic related
This is how it's supposed to look like
Rules:
>all print statements must be used with loops
>only one * sign per print statement


Don't help me too much. After all I am supposed to learn. All I need is a little advice

why would you create a loop and if statement if you only need user function for a simple if?

less code, more readable

what a n00b cake

...

how do you use simd

You can't with C because it was created before SIMD was a thing. The more pathetic thing is you can't with languages created after either, so you have to resort to assembly.

That's how i also feel Usagi-chan!

>Don't help me too much. After all I am supposed to learn. All I need is a little advice
do it yourself

Write some examples by hand first.

check if the compiler flag is set
if it's set the simd functions are something like __some_stuff_to_vector
You can take reference from some game engines or scientific libraries that do vector math

First party back ends will generate their own machine code.

software engneering or embedded development?

development engineering

negative

Well, object code.

Pick machine learning like all the cool kids. And all the non-cool kids. And everyone else not in either of those two groups.

So just to make sure I get this right, if I use XADD (exchange and add for i386+) nothing would prevent another of my CPU's core to XADD at the same time and fuck shit up right?

I meant i486+

I have been doing that for well over an hour now. Best results I got was pic related.

code artisanship

Is jvm the platform to target?
>can use multiple languages that compile to javabyte code
>can export applications to pc/mobile
>cross platform GUI API with javafx, even for mobile
Compared to native applications/libraries
>every relevant library is sepples shit and doesn't export C API
>no cross platform GUI(none of them run properly on mobile) library unless go some fucky route like using SDL with nuklear+opengl
>linking and compiling is pain in the ass
Sepplesfags can go kill themselves because of them nothing cool works with just C, jvm seems the best option for now...

Yes, this is why there's no point in using xadd without the 'lock' prefix.

Prefixing with LOCK will.

>jvm seems the best option for now.
that'd be javascript

learn C++ brainlet

It's better than XCHG and then ADD.

Make some arrays that specify which positions you want filled in with asterisks based on the row, and then use a for loop or two for the print statements

write a function print_line(int num_stars, int line_length) that prints a single line. be sure to pad the stars with the proper number of asterisks

>js
not programming language
also browser is the shittiest software to run applications on
>sepples
Not portable, does not by default work with other languages, made by nigger Stroutrup
Also no decent GUI library either, QT requires you to sacrifice multiple goats and childrens to get it to work

>complains that all libraries are for C++
>complains that C++ has no libraries

I have gotten to Arrays but they are not to be used. No if or else statements, no methods. Only loops and one print * statement(and " ").

>IQ 132
it shows

So what's the current pay rate for an Oracle shill?

pad the stars with the proper number of spaces, I mean

>c++ has no good GUI library
>c++ libraries don't export API that you could use from other lanaguages

I can't use functions. If I could, it would be much easier
it's seriously my measured IQ, but I always feel like a dumb shit when it comes to things like this

eyyy

he's right you know.
the only superior target is javascript but js is a nightmare to program in

I don't know but as far as I know oracle doesn't require you to pay if you ship jvm with your application.
Meanwhile cppcon and sepplesfags continue to ruin the world.
Not saying oracle is any better, but sepples is not answer to anything.

What are you trying to do?

>i cant use functions
write it, then inline it before you turn it in

Was for

>also browser is the shittiest software to run applications on
What
Why?

>cannot manage to use brainlet-tier Qt
>thinks his opinion matters

>every application needs to ship whole HTTP cliet, HTML renderer and JS interpreter into the application
>js is the worst language ever created
>nobody even follows THE STANDARD

b-but webassembly

I'll guess this might work in Java unless return 1 would have any impact

It does not export C api.
It does not exists.

Bloomers are a miracle of the universe.

The whole idea of "cross-platform development" it a meme. If you're developing for server-side, 99% you're targeting Linux, if for desktops - you're targeting Windows and maybe macOS but not really, if you do mobile you're targeting Android and iOs and Java won't help you with the latter. Every platform has its preferred set of tools, and there's no reason to use inferior "cross-platform" ones, because code is unlikely to leave the platform it's written for.
>oracle doesn't require you to pay if you ship jvm with your application
This is where you're wrong, kiddo: theregister.co.uk/2016/12/16/oracle_targets_java_users_non_compliance/

the trick is to realize that the spaces to the right of the diamond don't need to be printed

>>every application needs to ship whole HTTP cliet, HTML renderer and JS interpreter into the application
And these are shipped with every phone, tablet and computer by default.

So it's better to actually take Swift if you are into iphones and Java for Android? Xamarin is "inferior meme" according to your post, is that so senpai?

well then I doubt there's any need for that in Java as the spaces to the right don't influence anything

Xamarin is fine, but it only targets mobile, which makes sense.

Thanks alot. That worked. Although I wasn't supposed to copy anything and try to learn it by myself, but guess I had no other choice. There was never a requirement that I need to do it completely on my own though :^)

well done user you learned nothing

Just link your C lib against a C++ Qt application that uses your lib. It's brainlet-friendly as fuck.

>wake up
>modern irc has chrome engine inside of it
weird times desu

He learned to take credit for someone else's work. That's probably the most valuable lesson there is.

qt doesn't export C api, dumbfuck

sure thing
these type of trick problems are a waste of time
instead, the time wasted on this IQ test question can be used to learn something useful

;_;
I will try to use it as reference and try to work on a code that is slightly different but follows similar principles

I just hope I won't get something similarly limiting on my exam

they wouldn't put this shit on an exam unless you're in a top school, and even then I seriously doubt it
an average IQ person wouldn't be able to solve it given the entire length of the test

Rate my code, /dpt/.
int
high_pow (char number[]) {
int number_len, power, ap_group;

power = 0; ap_group = 0;
number_len = strlen(number);
for(number_len--; number_len < 0; number_len--) {
if (number[number_len] == '\'')
ap_group++;
else {
if (!!ap_group && (ap_group

>export c api from your lib
>link
>use
what's the problem here, why does qt need to export c api?

dumbfuck

I know that, user. You don't need a C++ API to link a C++ application with a C library. You just expose a C API (for your code) to be used inside a Qt program.

you are fucking with him now aren't you

no

Would still require you to write the gui stuff in sepples fucking retard

Imagine that, using a C++ GUI library requires you to use C++. Better kill yourself, I user.

The original point was that there's no good native GUI library, dumbfuck.

>an average IQ person wouldn't be able to solve it given the entire length of the test
You mean this is actually a very hard task?

There's Qt.

best way to learn java? the codecademy tutorial was shit

>qt
>good
>not even exporting C API
It's shit beyond the borders

yes
especially the requirement to keep it under 7 lines
the average person, even if they could solve it in time, would do so with 20+ lines

#include

int main (void) {
int offset[7] = {18, 14, 10, 6, 10, 14, 18};
int stars[7] = {2, 10, 18, 26, 18, 10, 2};
int i, j, k;

for (i=0; i

he said arrays are not allowed to be used

oh i did not see that

#include
int main (void) {
int offset[7] = {18, 14, 10, 6, 10, 14, 18};
int stars[7] = {2, 10, 18, 26, 18, 10, 2};
int i, j, k;
for (i=0; i

that's actually quite relieving to hear. Thank you

If I could use arrays, it would be far more easier as I could just have added the amount of spaces and stars to the list.

Employed Haskell programmer here