/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

github.com/mosra/magnum/tree/master
mosra.cz/blog/magnum-doc/building.html
github.com/enfiskutensykkel/bf-compiler
twitter.com/SFWRedditVideos

Haskell is basically the minimum acceptable language these days.

Is there any point in learning assembly in the year 2016?

basically the minimum acceptable language these days is Haskell.

Are you programming PICs? Then yes. Otherwise, no.

If you actually want to be employable, you will write your frontends in JS and your backends in C.

these days, the minimum acceptable language is basically Haskell

Compiler backends
Reverse engineering
Shellcode
Boot level code/firmware

It has its uses.

Not him, but you'll never need any of that. Just learn a language like python.

Is it autistic to use greek unicode symbols in my variable names?

No.

Stop wasting time with outdated and obsolete languages like Haskell or Assembly. Python is all you'll need these days.

REAL THREAD

if you mean it's basically the worst language then yes

Yes

your thread is old and busted

kys fag

Fuck off.

you can't even say kill yourself, you dumb redditor?

kill yourself

kill yourself FAG

Fuck off faggot

>you'll never need any of that
Depends what you're working on. While there are certainly plenty of applications where you can get by only knowing Python, how would you expect someone to, for example, write an emulator, without knowing assembly?

>REAL THREAD
bwahahahahahaha

>also: bamp

stay delusional shitty fag poster, if this thread was legit you wouldn't need to bump it

REAL THREAD

bampity bamper bamp :^)
fuck off with your pedo shit

i took apart an apk and i want to know how to correctly upload all the resources into android studio and make it work

>using the smiley with a carat nose

>Posting your stupid memes just to bump this degenerate thread
Kill yourself

tell that to whoever decided to bump the thread with the smiley with a carat nose

:::::::::::::::::::::^)))

bump lol

Quick C++ question. I'm leaning about scope and references and I thought of this code to test what happens.

#include

int a = 11;

int main(){
int &i = a;
a = 40;
std::cout

install gentoo

Planning on learning C++ by doing the Programming Principles book by stroustrup, and later the regular C++ programming book he made. Any suggestions for other books to read?

i is a reference type. Whatever you do to i will be done to a, and vice-versa.

Let me add this too:
Because i and a represent the same object.

Yes but aren't there actually two 'a's: each belonging to the outer and inner scope? So
a = 40; actually declares a new 'a' in the inner scope that is independent of the outer 'a', right?

cont.

#include

int a = 11;

int main(){
int a = 40;
std::cout

i made PERFECT TABLE

When you declare and define a outside of main, you create an integer in the global scope called a. In your first example, you did not declare a in main so it defaulted to the global scope a. In the second example, you defined a global and local a so it prints 40 then 11.

no, a = 40; refers to the global a. If you did int a = 40; you would see this behavior.

> actually declares a new 'a'
No it doesn't. That's not a declaration, it's just assignment.

This declares a new, distinct variable. But there's no i in this so what's your question?

accidentally forgot to reply. Make sure you understand how declarations and definitions work since that is the root of your confusion.

ah! thanks mang

What's your excuse for not knowing C?

Working on a new personal startpage

Then hopefully to make my first iOS app, just a thing for the notification center

What should I name my rss reader?

RSS Reader Pro™

Good names don't describe the product

You joking man? That name might not be "good", but it would sell like $$$FIRE$$$

Exactly.

RSS Reader Pro

Js, actually need some help on this. Im trying to make a conditional statement where 3 statements need to be true, but when i use the string color == "black" with && it doesnt run, the other two statements are fine however. Heres the code

var toes = 3;
var digTime = 30;
var color = "black"
if(toes == 3 && digTime == 30 && color == "black"){
document.write("I am a bradypus sloth");
}
if else(toes == 2 && digTime == 30){
document.write("I am a 2 toed sloth");
}
else{
document.write("I am not a sloth");
}

>source
source?

source: hime;goto source;

r'ing the "size in bytes" webm.

Also, practicing some algorithm writing in C.

What is that webm? A list of sizeof's for x86_64?

The himegoto webm used sometimes as the OP image.

I need some help understanding this.

I'm trying to build this:
github.com/mosra/magnum/tree/master
using cmake, visual stuido and clang on windows.

But I really can't figure this out.
I either need some materials to help me with what's going on or some pointers.

I try setting CC and CXX to my llvm installs clang-cl and clang++ executable path's but it still says
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /c/MinGW/bin/cc.exe
-- Check for working C compiler: /c/MinGW/bin/cc.exe -- broken
CMake Error at /usr/share/cmake-3.3.1/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/c/MinGW/bin/cc.exe" is not able to compile a simple test


I'm so unfamiliar with this.

>using cmake, visual stuido and clang on windows
Yick. What an overcomplicated development environment.

It looks like you're not pointing to clang correctly. Are you sure you have the file paths entered correctly?

>PATH=/c/Programs/LLVM/bin:[...]
Yep. Put it at the front too (this is cygwin translating the path, it's written like any other path would be on windows).

I'm inclined to agree this seems incredibly complicated given what it has to do. But I'm inexperienced so I can't really say anything.

Should I just install Linux in a VM and try there?
I don't really mind. Supposedly cross platform deployment is very easy with this graphics engine.

You could just use cmake from cygwin since you already have it installed.

I already am though. I just imagine most of the people working on this are on Linux. I'd rather not use mingw since the readme says:
>Note that full feature set is available only on GCC 4.8.1 and Clang 3.1.
I don't really know what the difference would be though..

If you're using it from the the cygwin command prompt then what do you mean you're using visual studio?

It's supposed to produce a visual studio project file which I can open and then develop using.

But I've found this now:
mosra.cz/blog/magnum-doc/building.html
Gonna try more.

New to C and already know Python but would like to do the following from python to C:
a = "N"
b = "Z"
c = "P"
a = b
What I think I'm doing right now in C is:
char a[] = "N";
char b[] = "Z";
char c[] = "P";
Not sure if this is correct, any help lads?

Still same issue..
I'm just gonna sleep on it.

That's valid but you'll have to use memcpy to set a to b.

It is more idiomatic to do
char * a = "N";
char * b = "Z";
char * c = "P";
a = b;


The
char a[] = "N";

is static initialization of a to the char array {'N', 0}, whereas the other is setting a pointer to the immutable string literal "N".

Soo what's the goal of that python code?
char a[] = "N";

Declares A as a characterpointer pointing to the string literal "N\0" (N with null terminator, standard for strings in C, null terminator just means "string is over" usually).
char a[] = "N";
char b[] = "z";
a = b;

Would mean you now have a pointing to that array of characters AND b pointing to that array of characters. So you can reference "N" through b. But it's not a copy.
You would ahve to use memcpy to make a copy.

>Declares A as a characterpointer pointing
No it doesn't. It's declaring an array. To see for yourself do sizeof(a); (it's 2, not 8).
>a = b
is invalid. You can't assign arrays.

My advice is to stay the fuck away from arrays as much as possible if you're new. They're a bit of an advanced topic and pointers are much simpler.

True. Weird how I didn't know that.
I guess I never did weird stuff like that I suppose.

Hime is code. Hime is love. Hime is life.

...

What does the * do, i heard it has something to do with pointers.

Yep arrays are weird. Here's some code to look at to see how arrays work a little more in C.
#include
//shorthand for char a[2] = {'N', 0};
char a[] = "N";

//This type signature is a lie
//it is actually void foo(char * fnord)
//in my opinion using a signature like this bad practice because it is deceptive
void foo(char fnord[]) {
printf("size of fnord: %i bytes\n",sizeof(fnord));
}

int main() {
char * a_ptr = a; //this is possible because of "array decay"
printf("a: %i bytes\n",sizeof(a));
printf("a_ptr: %i bytes\n",sizeof(a_ptr));
printf("Now for some function signature lies\n");
foo(a_ptr); //this is valid because the type signature is a lie
foo(a); //array decay happens
return 0;
}


It's the signature for a pointer.
char * ptr;
is C for "create a pointer to a char named ptr."

Would it be possible to do something like this?
Say:
char a[] = "N";
//do stuff i.e. if statements
//then go back and do this:
a = "Z";

Struct packing:
#include
struct strange { char c; int i; char d; };
struct optimized_strange { int i; char c; char d; };

int main() {
struct strange fnord = { 'N', 0, 'O' };
struct optimized_strange ok = { 0, 'N', 'O' };

printf("fnord size: %i bytes\n", sizeof(fnord));
printf("fnord.c size: %i bytes\n", sizeof(fnord.c));
printf("fnord.i size: %i bytes\n", sizeof(fnord.i));
printf("fnord.d size: %i bytes\n", sizeof(fnord.d));

printf("ok size: %i bytes\n", sizeof(ok));
printf("ok.c size: %i bytes\n", sizeof(ok.c));
printf("ok.i size: %i bytes\n", sizeof(ok.i));
printf("ok.d size: %i bytes\n", sizeof(ok.d));
return 0;
}


No. Assignment to arrays is undefined unless it is static initialization. You should seriously stay away from arrays.

Damn C is hard. I liked the days where python or java made me look smarter. Now i cant even assign strings into a variable.

Just use char pointers to string literals char * string = "literal"; and the functions in string.h

If you just do the same thing but don't use [] and just put * before your a/b/c it works.

>var color="black";
YoU mIsSeD a SeMiCoLoN!!!

>posting the homosexual trap anime image

Maybe I can get an answer here...

I want to try using a surface pro 4 for c#/unity programming. Is this feasible?

I want to be able to program on the go, but also use it to play vns while comfy. Is this a longshot, and my money would be better spent elsewhere?

SHIETTT thanks lmao, spent quite some time trying to find the error..

Well I'm an idiot.. haha thanks senpai.

this
you might as well learn it, you can easily do it in a few hours
assembly is pretty easy on its own, the difficulty comes from the code being large as fuck

It'll work. not sure what vns is but you can at least program.

how does your company manage sql migrations?

I don't really know about assembly being easy. It's pretty difficult to read because you have to keep track of what is in what register and whatnot. There being so many aliases of each register that have subtle differences is hella annoying. rax, eax, ax, ah, al oh boy. Then there's a million slightly different versions of each instruction: jl, je, jne, jz, jnz jnl, jg, jng. The instructions are also annoying because a lot of them like lodsp, idiv, je assume certain register states.

Hey Sup Forumsuys, I'm reading C primer plus, and was wondering if somebody could recommend a better source for learning file I/O, I just don't feel like I'm understanding how its laid out in that book.

real thread:

This one is older you dipshit.

this one was never legit

>What are you working on, Sup Forums?
I just completed my Brainfuck compiler for Mac OS X.

I will see if I will ever get bothered with optimising it. Right now every single increment or decrement will do a load + incr/decr + store, which I guess is not the most efficient.

Also, I will see if I ever have time to complete some options (like specifying cell width, array size, EOF behaviour, OOB behaviour etc).

Oops, forgot link:

github.com/enfiskutensykkel/bf-compiler

I don't care how much you hate trapfags, this one is older. Stop creating duplicate threads out of your autistic hatred.

Both threads are 10 hours old you dip, who are you even bitching at?

Compare
This thread is 4 hours older.

have fun posting in this forced fag thread then idiot

It's just an opening image, fag.