[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 32
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old thread: >>54744605

What are you working on /g/?
>>
>>54750726
?????????????????????????????????????????????????????????????????????????
>>
>>54750708
>>54750779
BLOWN THE FUCK OUT
>>
>>54750793
>Cast something to char *
>It magically aliases with everything else
I think any compiler would be smart enough to know that it only aliases what you casted from.
int fill(int *restrict x, float *restrict y) {
*x = 1;
*y = 0.5;
return *(char *) x;
}

The char * couldn't possibly alias y.
>>
>>54750848
it's different when you use restrict, otherwise it's not allowed to assume that it doesn't alias anything besides what you casted from
>>
>>54750915
kys
>>
>>54750708
>the char* can alias both x and y
it can alias x OR y
>not allowed to be reordered
they are
>char* might alias y
it aliases x, as it's obvious from the code
>would be incorrect to reorder
the standard allows it
>>54750777
it's undefined behavior
>>54750779
>irrelevant
aliasing rules are irrelevant? were you dropped?
>for the same reason as here
those can be reordered because there's no dependency between i and f
>>54750793
>BLOWN THE FUCK OUT
no, this is BTFO: >>54750386
>>
>>54750980
go ahead and tell that to the gcc devs then, chump
>>
>>54750980
>it's undefined behavior
No it's not. Sure, he's not calling the function correctly, as he should be using the members, but C11 allows you to read union members that wasn't the last one written to.
>>
>>54751032
what? that the "literate" fag can't read a 3 line function? which one of the points do you object to and what are your arguments besides "gcc does it like this"?
>>
File: 2016-05-05_153133.jpg (103 KB, 871x550) Image search: [Google]
2016-05-05_153133.jpg
103 KB, 871x550
>trying to get F# to run in Monodevelop
>error during plugin installation, even though I did every step as described in their manual
>try to run it anyways, and manage to open a new file with working syntax highlighting and tab completion
>doesn't compile inside Monodevelop
>some random dude from 2014 had the same issue
>it got closed without being solved
>TWO FUCKING YEARS AGO

so this is why nobody uses F#.
>>
>>54751034
>No it's not.
don't make definitive statements when you don't know what you're talking about because you'll get rekt
>but C11 allows you to read union members that wasn't the last one written to
are you making random statements? because it has nothing to do with why this is undefined
>>
>>54750793
why would you say that when your ass is still bleeding? :^)
>>
>>54751271
I've been up for almost 36 hours now finishing up an opencv program for a competition. I hope it works...

https://www.youtube.com/watch?v=TzAjEIMqkAo&list=PL2dAOzo3a1SqxkO_c7mVzUcQh5leLHjsX&index=1
>>
>>54750901
>it's different
no, it isn't: int and float can't alias by default
>>
>>54751568
char* can alias any pointer by default
>>
>>54751586
of course, why would you feel the need to mention it? I said int and float, didn't mention char
>>
>>54751605
the code has a cast to char* you dickbutt
>>
>>54751638
yes, it does; did I say otherwise? what are you trying to say? learn to express your thoughts, muppet
>>
>>54751679
the code behaves differently with/without the restrict keyword, check gcc output if you don't believe me
>>
>>54751073
use vscode (has intellisense) like everyone else on linux (or vim/emacs)
>>
>>54751696
gcc 5.3 produces same output
>>
>>54751785
gcc 6.1 doesn't
clang 3.8 doesn't
icc 13.0.1 doesn't
>>
>>54751845
Nobody forces them to generate the same code; what does this prove? Do you also know compilers don't always enforce the standard?
>>54751696
>check gcc output
Why is /dpt/ so retarded? Do they know how proofs work?
"integer overflow is undefined"
>no, it just wraps around, check gcc output
"this kind of aliasing is undefined"
>no, it works, check gcc output
"x + x can be anything"
>no, it's always 4, check this example "2+2=4"
>>
>>54751989
>Do you also know compilers don't always enforce the standard?
older versions of gcc didn't enforce the standard in this regard but now it does
>>
File: baseurl.png (28 KB, 424x427) Image search: [Google]
baseurl.png
28 KB, 424x427
import re


url = 'http://boards.4chan.org/g/thread/54750726/dpt-daily-programming-thread'


def get_base_url():
base_url = re.findall(r'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}))', url)
print base_url


Anyone know of why this doesn't output the base url but still compiles. It matches with regex101.
>>
>>54752020
>now it does
How do you know? How do you know they haven't actually relaxed the rules to accommodate whiners?
>>
I understand that asm.js is purely for writing the algorithmic part of your application because there's no way to interact with the dom, but how are you supposed to interact with the js part?

Do I have to cook up some shit-tier message passing system?
>>
>>54752144
char* can alias any object, simple as that
>>
File: 1460623866107.jpg (69 KB, 640x563) Image search: [Google]
1460623866107.jpg
69 KB, 640x563
Anyone here know how to use SDL_net? I'm following along with a tutorial, but it's not working, and I cannot for the life of me figure out what's wrong.
>>
>>54750980
>it's undefined behavior
No, allocated storage has no declared type.
>>
>>54752195
You are spewing the same unrelated comment over and over again. Yes, char* can alias any object, everyone agreed on this already, multiple times. Answer the actual question if you can.
>>
Finished this for work today when I realized my workload for today was moot because fuckers can't keep LDAP up.

http://github.com/Maldaris/spring-model-generator
>>
>>54752237
>No, unsigned addition can't overflow.
It has nothing to do with what is being discussed.
int *x = malloc(sizeof *x);
*x = INT_MAX;
*x += 1;

>this code is undefined behavior
>No, allocated storage has no declared type.
See how retarded you sound?
>>
>>54752237
>allocated storage has no declared type
nobody claimed otherwise, you dip
>>
>>54752284
>>No, unsigned addition can't overflow.
>It has nothing to do with what is being discussed.
I know, I never mentioned anything about overflow.
>>
>>54752245
>How do you know? How do you know they haven't actually relaxed the rules to accommodate whiners?
the rule as mandated by the C standard is that char* can alias any object. therefore it is not valid in the code example to simply return the first byte of the int since the char* might alias the float*
>>
hey fags, what's a good book to learn ruby/rails quickly, an intro to RoR, or, at least, to use as reference?

>tfw should have learned ruby/RoR for an interview tomorrow, but didn't do so
FML family
>>
>>54752297
Then why are you calling it undefined behavior?
It's only implementationed defined.
>>
>>54752310 (Me)
>therefore it is not valid in the code example to simply return the first byte of the int since the char* might alias the float*
when the restrict keyword is not being used, i mean
>>
>>54752325
>ruby/RoR
D E P R E C A T E D

also >>>/g/wdg
>>
I'm learning assembly because it seems to be curing my depression.
>>
File: 1458136545652.jpg (16 KB, 201x179) Image search: [Google]
1458136545652.jpg
16 KB, 201x179
If I want to make a program to make myself white how would I go about doing that?
>>
>>54752330
>why are you calling it undefined behavior?
Because the call "f(p, p)" aliases a "float*" and an "int*" inside f.
>>
>>54752382
Not a problem.
>>
#! python3
# 4chan.org webscraper

import requests, os, bs4

url = 'http://boards.4chan.org/g/catalog'
os.makedirs('exampleFolder', exist_ok=True)

print('Downloading page %s...' % url)
res = requests.get(url)
res.raise_for_status

catalogSoup = bs4.BeautifulSoup(res.text, "lxml")
catalogElem = catalogSoup.select('#content #threads')

print(len(catalogElem))
print(catalogElem)

if catalogElem == []:
print('Could not find any threads')
else:
for item in catalogElem:
if item.get('class') == ['teaser']:
print(len(item))


Why won't it go further than #threads? I've even tried specifying a specific thread after #threads, but that doesn't return anything. What am I doing wrong with my basic webscraper?
>>
>>54752348
>>ruby/RoR
>D E P R E C A T E D
yeah, well, a job is a job.
>>
>>54752366
same, helps me dissociate and feel calmer and less emotional pain
>>
>>54752427
>a webcuck job of which the technology you're using you learned the day before the interview is an expert programming job
>>
>>54752372
Brainfuck. It's the most powerful language that will ever be invented.
>>
>>54752310
>not valid in the code example to simply return the first byte of the int since the char* might alias the float*
The whole point of the discussion is that the char* doesn't even matter! By the time the dereference through the char* is made, *x and *y were already accessed and those accesses can be reordered because x and y can't alias! That's where the undefined behavior is!
>>
>>54752080
\bhttps?:\/\/[^/]+
>>
>>54752413
>aliasing int* and float*
>not a problem
The standard disagrees with you.
>>
>>54752307
Yeah, you mentioned something equally worthless.
>>
>>54752483
Nope.
>>
>>54752448
they first asked for non-experienced devs, then changed things a bit by asking for a very simple app written in rails
still, perhaps I shouldn't go to the interview... should I?
>>
>>54752464
there is no undefined behavior. it's perfectly valid to cast any object pointer to char* and dereference it.
>>
>>54752508
Yep.
>>
>>54752524
Cite the standard then.
>>
>>54752470
>\bhttps?:\/\/[^/]+
Thank you
>>
>>54752535
this
>>
>>54752521
no, integer overflow is undefined
>>
>>54752535
http://port70.net/~nsz/c/c11/n1570.html#6.5p7
>>
>>54752543
if char is signed, sure it might be undefined for that reason, but not because of the aliasing stuff
>>
>>54752535
You don't seem capable of understanding it.
>>
>>54752557
char * is compatible with both int * and float *
>>
>>54752574
int* can't alias float* tho
>>
>>54752577
Oh I am, much better than you.
>>
>>54752592
char* can alias either
>>
>>54752580
int* is not compatible with float*
>>
>>54752609
Yes?
>>
>>54752600
Why do you consistently get raped in these threads then?
>>
>>54752630
I don't.
>>
>>54752625
yes
>>
>>54752648
no
>>
>>54752648
What's your point?
>>
>>54752644
Oh, buy you do.
>>
>>54752668
Nope.
>>
>>54752665
that you don't even know what the fuck we're talking about
>>
>>54752681
Yeah.
>>
File: 2016-05-26-1464280522.png (61 KB, 485x675) Image search: [Google]
2016-05-26-1464280522.png
61 KB, 485x675
nice thread
>>
>>54752683
That would be you.
Protip: read that link that posted carefylly again, notice "lvalue expression" then read paragraph 6 above it.
>>
File: 1447906866573.gif (2 MB, 430x440) Image search: [Google]
1447906866573.gif
2 MB, 430x440
>>54752200
Anyone?
>>
>>54752773
https://www.libsdl.org/projects/SDL_net/docs/SDL_net_frame.html
maybe it's just too complex for you tho
>>
>>54752698
this
>>
>>54752698
real thread here

>>54750565
>>
>>54753012
kys
>>
>>54752832
https://www.youtube.com/watch?v=iJfC4-yNnzY

That's the tutorial I'm using. My code is nearly identical to that dude's, except when I start up the server, and then start up two copies of the game, the server tells me that the two players are connected, but I only see one player on each copy of the game. I'm trying to make a multiplayer game so obviously I need the players to be able to see each other.
>>
>>54753128
idk lol
>>
int fill(int *x, float *y) {
*x = 1;
*y = 0.5;
return *(char*) x;
}


int fill(int *restrict x, float *restrict y) {
*x = 1;
*y = 0.5;
return *(char*) x;
}


lol! stupid Ctards don't know the difference!
>>
>>54753222
C is the master race
>>
>>54753222
Literally no difference.
>>
>>54753222
$ diff -u /tmp/*.c | less
--- /tmp/1.c
+++ /tmp/2.c
@@ -1,4 +1,4 @@
-int fill(int *x, float *y) {
+int fill(int *restrict x, float *restrict y) {
*x = 1;
*y = 0.5;
return *(char*) x;
>>
>>54753348
yes there is one difference, in the second one, the compiler knows that the char pointer is not equal to y.
>>
>>54753401
Same as the first case: the char pointer is clearly equal to x.
>>
>>54753128
>>54753216
I think what I'm doing wrong is that when a new player joins, I create a new Player object. In his game, he creates an "enemy" object instead. Would it make sense to have a separate class that looks and acts almost exactly like a player, except it's not called a player?
>>
>>54753536
What I think should be happening is that as soon as there's a second player in the server / connection, a new player object should be created and rendered. If that doesn't happen either the second player isn't being created or there's an issue in rendering / network code
>>
>>54751073
if you're not on windows you should be running OCaml anyways
>>
Is it incorrect to say that in Javascript, operators (like +, -, /) are functions?
>>
>>54754350
You might want to ask in the real thread: >>54750565
>>
>>54754350
yes, you can't rebind them to a different function so they're operators and not functions
>>
>>54753905
>>54754421
>"Anonymous"
>Using a tripcode
>>
def pprint(string):
''' Print a string without creating a new line. '''
sys.stdout.write("\r%s" % string)
sys.stdout.flush()


\r enables me to print on the same line, but is there a way to guarantee that anything printed after this will be placed on a new line without breaking the functionality of the function?
>>
>>54752422
wat

>a.4cdn.org/gl/catalog.json
>>
Has somebody made a C project extension for visual studio?
>>
File: BASTA.jpg (65 KB, 731x590) Image search: [Google]
BASTA.jpg
65 KB, 731x590
I have a Java program that runs on IntelliJ with no errors but if I make a Jar following the "artifacts" procedure the jar doesn't work for shit.

I'm new to Java and this is making me more mentally ill that I'm already please help me.
>>
https://www.youtube.com/watch?v=GhygOO_CSRY
>>
>>54753423
all the leading compilers disagree

char pointer can alias any object pointer, including y
>>
Dubs chooses what I program in an hour
>>
>>54757390
>all the leading compilers disagree
no need to lie on the internet, especially in a fake /dpt/
>>
I feel enlightened. I understand why Π-types are functions and why Σ types are pairs.
>>
>>54757484
explain?
>>
>>54757484
>why Σ types are pairs
no. Π-types are functions, hence pair is a special case.
>>
Is it autistic to use unicode greek symbols as variable names?
>>
>>54757651
no
>>
>>54757459
see >>54751845
>>
File: Untitled.png (9 KB, 576x394) Image search: [Google]
Untitled.png
9 KB, 576x394
>>54757558
The type represents the number of objects of that type. For instance it is possible to have the unit type denoted as "1" (the unit being the single object of the type), the boolean type denoted as "2" (true and false), and the bottom type denoted as "0" (no objects, meaning no proofs).
This makes a lot of sense when we do things like represent the non-dependent pair as multiplication (A x B) and dispoint union as addition (A + B).
We can really understand why A x B is multiplication by organizing all of the elements of A x B into a grid and shown to the left (1000 hours in ms paint).
color coding:
a1, a2, ... : A
b1, b2, ... : B
(a1,b1), (a2,b1), .. : A x B

Thus it's pretty clear that the total number of elements is equal to elements in A times elements in B.

(cont.)

>>54757604
Everything is a special case of the dependent function but that's not the point.
>>
>>54757761
>Everything is a special case of the dependent function but that's not the point.
Yes and sigma is union not product. And a pair is a product.
>>
stop spaming this shit thread and let it die
>>
>>54757820
kys fag

you're the one who should stop spamming your fag shit

you didn't even wait until the bump limit of the old shit thread
>>
>>54757707
>see
did you pass -fstrict-aliasing to enforce the standard behavior? no? you don't say! I'm shocked you'd make claims without covering your bases first, anon!
now, fuck off
>>
>>54757797
Lemme finish.
Product means pair. Sigma means dependent pair.

>>54757761
Now to understand why on earth Σ (repeated addition) represents a pair, even though pair is usually product, see the next drawing.
Since the type of the second element of the pair B(a) depends on the first element of the pair a, that means that the number of objects in that type B(a) also depends on the object a. So therefore instead of an easy rectangle like we had in the previous post, we have a series of rows (for each a in A), with a variable number of collumns (variable, dependent on a). Thus the number of elements in the dependent pair can be found by summing all of the collumns in the rows.

(cont.)
>>
File: Untitled.png (9 KB, 826x431) Image search: [Google]
Untitled.png
9 KB, 826x431
>>54757901
shit here is the picture
>>
Reminder that languages with first class types > languages with dependant types
>>
>>54757844
>you didn't even
did you, pedoshit?
>>
>>54757955
i posted after 309 replies with my new thread link being the 310th reply, and this was after the smug fag posted at like 301
>>
>>54757761
if we see generic type list as a function from a type to another type
list (x) = 1 + x * list (x)
ie list is empty (1) or (+) a head and a tail (x * list x)
so
list(x)-x*list(x)=1
so
list(x)=1/(1-x)
so
list(x)=1+x+x^2+x^3...
so
a list is
an empty list(1) or (+) a list of size 1 (x) or a list of size 2 (x^2)...

if we differentiate

list(x)=1+x*list(x)
list'(x)=x'*list(x)+x*list'(x)
list'(x)=list(x)+x*list'(x)

if you take time you'll realize that list' is a position in a list
>>
>>54757890
yes i did, idiot
>>
>>54757986
And I forgot, you're wrong about pair. They're product, not sigma.
>>
>>54757981
>and this was after
why make a new thread?
>>
>>54758004
see >>54757459
>>
REAL THREAD THIS WAY:
>>54757455
>>54757455
>>54757455
>>
>>54758038
it's included in -O3 dipshit and if you pass it explicitly the output is still different with/without restrict because the plain strict aliasing rules don't cover this case with the char*
>>
how does one create cool lighting effects like in unreal engine. Im working on creating my own game engine. Nothing as robust as unreal engine, but just what fits my needs. And unreal engine light effects can be that complicated right?
>>
Any way to call ZwQueryVolumeInformationFile (https://msdn.microsoft.com/en-gb/library/windows/hardware/ff567070%28v=vs.85%29.aspx) from usermode? I don't want to write a driver just to get my filesystem info.
>>
yo give me some text-based game ideas
>>
>>54758105
>it's included
so you lied here >>54758004
>the output is still different
really? for all these >>54751845
come on, make yourself look like shit once more, you worthless shit stain
>>
File: Untitled.png (9 KB, 866x637) Image search: [Google]
Untitled.png
9 KB, 866x637
>>54757950
Dependent types are first class objects, and objects are first class types.

>>54757986
Wow, differentiating dependent types. That's really rad.

>>54758007
https://en.wikipedia.org/wiki/Dependent_type#Dependent_pair_type
Also, if you think about it mathematically, summing a constant = multiplication, therefor sigma is a product, when the summed elements are not dependent.
e.g. Σ (n=1 → 5) 3 = 3 + 3 + 3 + 3 + 3 = 3(5) = 15

>>54757901
>>54757920
So time to talk about functions. Starting with non dependent functions first, we all learned from algebra in highschool that you can draw a function like a line on a graph. This is of course because every x value corresponds to a y value from the equation y = f(x).
Now in type theory let's stick to distinct objects rather than a continuous line. Our function f : A → B maps objects a : A to other objects b : B. Every a maps to some b.
Thus we can draw this out as a grid, with the rows denoting inputs a1, a2, ... and the collumns denoting possible outputs b1, b2, ...
The filled in squares represent the output of the function, in this case f is orange and g is green.
f(a1) = b1
g(a1) = b3
f(a2) = b2
g(a2) = b3
etc.
Now remember earlier that the type represents the number of objects in the type. So using probability we can determine that there are B^A combinations of functions of type A → B
>>
>>54758245
Dependent typing is a specific kind of first class typing, from what i've seen
>>
File: Untitled.png (8 KB, 624x468) Image search: [Google]
Untitled.png
8 KB, 624x468
>>54758245
Now understanding dependent functions as Π (repeated multiplication, a less common operator than Σ), we do the same thing as with Σ-type. Instead of an obvious rectangle, we have rows with variable number of collumns. The number of possible functions (h) of this type can be found by multiplying the length of each row.
>>
>>54757761
>Everything is a special case of the dependent function but that's not the point.
Only if you've got an impredicative theory. Try Church-encoding sigma in CIC, for example.

>>54758261
Not really. First-class types make me think of reflection, whereas dependent types are where the type checker can use values as types. So they're orthogonal. If your universe type has an eliminator, you've got reflection, and therefore both.
>>
>>54758227
gcc and clang still give different output with -fstrict-aliasing. icc doesn't, but it's a compiler bug
>>
what's the difference between logical not and bitwise not?
>>
>>54758392
First class types is not just types as values but values as types, in any fashion

Typed dynamic languages would inherently have (mostly) first class types
>>
>>54758418
>values as types, in any fashion
I.e. dependent types.
>>
>>54758409
Logical not is bitwise not on a single bit

>>54758426
Pretty sure dependent typing implies a specific kind
>>
>>54758409
How good is you binary
>>
>>54758431
Dependent typing means that terms appear in types, in any way.
>>
>>54758409
bitwise flips all bits, logical flips from 0 to 1 and from any non-0 to 0
>>
File: index.jpg (8 KB, 299x169) Image search: [Google]
index.jpg
8 KB, 299x169
i took apart an apk and when i dump it into android studio i get errors and cant run it.


The apk installs content to a created path. I want to create my own because i want to start selling my game expansion packs.
>>
>>54758442
>selling my game expansion packs
>for cracked games
good luck in court
>>
>>54757604
>>54757797
>>54758007
Dependent product ~ Cartesian power (function)
Dependent sum ~ Cartesian product (pair)

Cartesian sum (union) doesn't have a dependent analogue, but can be easily encoded using a dependent sum. In the same way, a Cartesian product can be easily encoded using a dependent product. A dependent sum can only be encoded as a dependent product if you have impredicativity.
>>
r8 Udacity for learning shit?
www.udacity.com
>>
File: 1442758241336.jpg (182 KB, 978x655) Image search: [Google]
1442758241336.jpg
182 KB, 978x655
>>54758552
>python
>>
File: 492.png (41 KB, 930x794) Image search: [Google]
492.png
41 KB, 930x794
>>54758505
good luck telling your parents that your gay.
>>
Alright, this seems to be the thread everyone's stuck to. Curious, does anyone know of any good resources on binary translation? That is, recompiling -- either dynamically or ahead of time -- machine code from one architecture to another. I am now morbidly curious about whatever literature there is on the subject.
>>
>>54758603
what errors are you even getting, are you following any decent tutorials for decompiling apks, do you know anything about app signing
>>
>>54758552
so... 30cm?
>>
>>54758724
yeah
>>
so I asked my friends for advice as to which language I should learn first, and which book I should read.

One of them said Java
Another said C++ with the Bjarne Stroustrup book
Another said Racket with SICP/HTDP
and another guy said Python

who do I listen to
>>
>>54758870
Not the guy who said Java, not the guy who said Racket and not the guy who said Python
>>
>>54758870
java or C++
or java followed by C++
whatever you do, don't go with racket or python
>>
>>54758870
>who do I listen to
Literally none of them.

1 is a retard, 2 is a retard, 3 is an autist, and 4 is a memer.

>>54758911
>C++ as a starting language
Fucking retard.

>>54758924
>seriously considering Java a good starting language
Off yourself.
>>
>>54758943
>Literally none of them.
i like the part where you came up with a better suggestion
>>
>>54758870
with python you can make shit happen with very little knowledge, it's really simple to understand too

if that's what you're after go for it
>>
>>54758943
There's nothing fucking wrong with C++ as a starting language you dumbass
>>
>>54758870
https://docs.oracle.com/javase/tutorial/
>>
>>54758958
don't listen to this guy
It's really no easier than learning anything else, except it gives you really bad habits
>>
>>54758959
Maybe if you're a poo in loo pajeet that's in a codemonkey CS program.

>>54758950
Even C would be better than any of them, aside from maybe Python.

>>54758970
Whatever you do, don't try and learn from this garbage.
>>
>>54758723
i already decompiled it. Its just dropping it into android studio and then getting alot of syntax errors to where i cant run it on the emulator.

I do know that the app signing has to be the same as the apk when i start the project.
>>
>>54758976
this, and you're barely scratching the surface, after several months of python you have literally like a few days to a week worth of java knowledge
>>
void (*(*f[])())()


Friendly reminder that this is syntactically valid C.
>>
>>54758950
Scheme shits all of those choices, as a starting language.
>>
>>54758988
epic meme fag
>>
File: 1456504577353.gif (1 MB, 400x225) Image search: [Google]
1456504577353.gif
1 MB, 400x225
>>54759000
Okay
>>
>>54759000
And?
>>
File: [tilting increases].png (27 KB, 500x500) Image search: [Google]
[tilting increases].png
27 KB, 500x500
>>54759007
>>
File: 1423191781848.png (88 KB, 1200x1200) Image search: [Google]
1423191781848.png
88 KB, 1200x1200
>>54759008
>choosing Java or C++ to start
>>
//+658902u5j 2.0pfmq,wd<;# 124= 15912u09724


Friendly reminder that this is syntactically valid C.
>>
File: Sdl-logo.png (39 KB, 457x266) Image search: [Google]
Sdl-logo.png
39 KB, 457x266
Anyone know a good SDL2 + OpenGL C tutorial/reference? I've been looking around but most shit is outdated and doesn't provide code that compiles.
>>
>>54759024
>choosing C or python to start
>>
>>54759021
I'd rather be an fedora-tipper, instead of a Rasheed.
>>
>>54759029
// means comment, idiot
>>
>>54759032
Lazy Foo for SDL2 and open.gl to start with OpenGL.
>>
Can anyone recommend a good Java book? Also what sites do you lads use for tech/programming news?
>>
>>54759029
only C99, in true ANSI C thats invalid
>>
>>54759032
RTFM

https://open.gl/ if you just want to get started with some basic shit but you still need to RTFM
>>
*(*(*(arr+i)+j)+k)


Friendly reminder that this is syntactically valid C.
>>
>>54759033
if you aren't a brainlet, C is better than any of the shit suggestions, aside from Racket, but Racket is a meme
>>
>>54759067
>C
>the current year
have fun never being able to understand OOP or making anything beyond fizzbuzz tier complexity
>>
>>54759091
>OOP
>Not complete garbage
>>
char ** const * const x
/* and */
volatile char * const c;


friendly reminder, this is syntactically valid C
>>
>>54759110
this is what Ctards actually believe
>>
long long long long long long long long long long i;


this is valid C
>>
>>54759120
OOP as a whole is pretty much useless. If it's the only way (in your language) to get certain features, like encapsulation or dynamic dispatch, then yeah, you're kind of stuck with it.
>>
>>54758870
starting with something like C++ you'll just feel like it takes so much shit to do anything and end up being demotivated to keep going, start with something simple and when you feel comfortable with the basics move on to some other language
>>
why can't I read from a .csv file with a while (in.hasNextLine()) on java?
from my point of view it should work, and the .csv is pretty simple and clean, so I don't know
this should be a list of country and population, like
Taiwan,25 155 655
so I tried
        File inputFile = new File("paises.csv");
Scanner in = new Scanner(inputFile);


while (in.hasNextLine()) {

String[] line = in.nextLine().split(",");

System.out.println(line);
}


but it's like the while doesn't work, if I put a system.out just to check if it got there, nothing happens, as if there was not next line
>>
>>54759229
what does the debugger say about hasNextLine()?
>>
>>54759029
kek
>>
>>54759267
what do you mean? it actually compiles and runs without a problem, I'm on blueJ and the debugger shows nothing, which is worse I guess
the problem is something related to dealing with a .csv, if I make a txt with just names in each line it reads fine, but a .csv with names and numbers separated by commas messes it up for some reason
I needed to read each line and test to save the bigger population on a variable, then the smaller, and that was the only way I thought about it
>>
>This is idiomatic C++ and considered good practice
??=include<iostream>
??=include<cwchar>
??=include<array>
??=include<algorithm>
int main() ??<
std::array<wchar_t,13>a??<??<L'H',L'e',L'l',L'l',L'o',L' ',L'W',L'o',L'r',L'l',L'd',L'\n'??>??>;
std::array<wchar_t,13>::iterator b = a.begin();
std::array<wchar_t,13>::iterator e = a.end();
std::for_each(b,e,??(=??)(wchar_t &c)->void??<std::wcout<<c;??>);
??>
>>
>>54759464
Not anymore it isn't
>>
>>54759475
Or at least probably won't be by C++17:

Trigraphs were proposed for deprecation in C++0x, which was released as C++11.[5] This was opposed by IBM, speaking on behalf of itself and other users of C++,[6] and as a result trigraphs were retained in C++0x. Trigraphs were then proposed again for removal (not only deprecation) in C++17.[7] This passed a committee vote, and trigraphs are expected to be removed from C++17 despite the opposition from IBM and others.[8] Existing code that uses trigraphs can be supported by translating from the source files (parsing trigraphs) to the basic source character set that does not include trigraphs.[7]
>>
r8 my first ever scheme program
#lang racket
(define (point-make x y)
(cons x y))

(define (point-x p)
(car p))

(define (point-y p)
(cdr p))

(define (point-add p q)
(point-make (+ (point-x p) (point-x q))
(+ (point-y p) (point-y q))))

(define (average x y)
(/ (+ x y) 2))

(define (midpoint p q)
(point-make (average (point-x p) (point-x q))
(average (point-y p) (point-y q))))
>>
>>54759496
Pretty homosexual
>>
>We graduate two times more Americans with STEM degrees each year than find STEM jobs, yet as much as two-thirds of entry-level hiring for IT jobs is accomplished through the H-1B program. More than half of H-1B visas are issued for the program's lowest allowable wage level, and more than eighty percent for its bottom two.
>Raising the prevailing wage paid to H-1Bs will force companies to give these coveted entry-level jobs to the existing domestic pool of unemployed native and immigrant workers in the U.S., instead of flying in cheaper workers from overseas. This will improve the number of black, Hispanic and female workers in Silicon Valley who have been passed over in favor of the H-1B program. Mark Zuckerberg’s personal Senator, Marco Rubio, has a bill to triple H-1Bs that would decimate women and minorities.
what did he meme by this?
>>
>>54759528
>I will end forever the use of the H-1B as a cheap labor program, and institute an absolute requirement to hire American workers first for every visa and immigration program. No exceptions.
I don't understand
>>
>>54759528
Who is "he"
>>
>>54759528
>>54759552
>>54759560
companies will just relocate off shore. the end.

now my question:
i took decompiled an apk and i want to know how to correctly upload all the resources into android studio and make it work.
>>
>>54758408
>icc doesn't
but you said it does and that you tested and that it's included in O3; what's that? you lied before about everything? you worthless sack of shit
>but it's a compiler bug
did intel confirm it? come on, shit eater, share with us! oh, it's just your opinion? end yourself retarded webshit
>>
File: trump tariff.png (27 KB, 1914x225) Image search: [Google]
trump tariff.png
27 KB, 1914x225
>>54759595
>>
>>54758408
>icc doesn't, but it's a compiler bug
top backpedaling m8
>>
>>54758408
>enforcing the standard is a bug
are you mentally ill?
>>
>>54755055
print("retard", end="")
>>
>>54758408
>I'll use compiler output to prove I'm right
>if it proves me wrong, it's a bug tho
>>
>>54759607
so not only would things become expensive, it would also be made cheaper.

i think its time for a socialist state or welfare state and encourage education and pleasure.
>>
File: angry crying feels man.png (9 KB, 205x246) Image search: [Google]
angry crying feels man.png
9 KB, 205x246
>>54759607
>>54759528
>>54759552
>forcing companies to pay H1B's the same as american workers and to prioritize americans over foreigners
>putting up a 35% tariff on companies outside of the united states
HOW THE FUCK IS THIS ALLOWED??? HE'S GOING TO FUCK OVER THE ENTIRE WORLD JUST SO A BUNCH OF CUMSKIN NERDS CAN GET PAID MORE WHEN I'M STARVING TO DEATH IN MY FUCKING HOME VILLAGE AND THERE'S SHIT EVERYWHERE AND I JUST SPENT A YEAR OF MY LIFE LEARNING CODING FOR THIS SHIT
>>
>>54759690
Suck a dick pajeet
>>
>>54759496
You could use structs and that would make your code a lot shorter.
>>
>>54759690
but wait theres more!!!

https://www.youtube.com/watch?v=vg0wCam2oDc
>>
>>54759600
>>54759620
>>54759632
>>54759646
samefag
>>
>>54759731
Considering that the latter 3 posts all occur ~1 minute after each other, you're probably onto something.
>>
>>54759757
i'm guessing it's the 'bick dick playa'

if icc is correct why don't you tell the gcc people to change it back to how it was
>>
>>54759403
Your code is okay. Something else must be wrong. Maybe the file can't be opened. Maybe the file can't be read. Maybe the file can't be found. Java 8 requires throws FileNotFoundException surrounding the Scanner(File) constructor. Maybe you accidentally dismiss the exception.

I recreated your code 1:1 on my computer and it works. No memes.
>>
>>54759782
>tell the gcc people to change it back
Why change?
>>
>>54753536
>>54753680
I don't think the video did a very good job at explaining it. Does anyone here think they could make some sense of the code?
http://hastebin.com/xemicekoku

The server code is in another .exe, it returns a number (the "type" variable) depending on the action it needs to take (a person connects, player moves, etc.)
Line 63 is what really confuses me. It gets called every single frame. He's adding a new object every single tick.
>>
>>54759782
>change it back to how it was
do you understand the concept of undefined behavior?
>>
hey /dpt/, is this a good idea or a waste of time?

I'm thinking of taking of just taking a huge bunch of coding problems and solving them, then writing them out in every language I want to market myself as knowing, and finally including a bash script that runs all the other programs on the spot.

Good idea, or worthless?
>>
>the aliasing argument is still ongoing

Holy shit.
>>
File: Capture.png (9 KB, 732x58) Image search: [Google]
Capture.png
9 KB, 732x58
what would you do?
>>
If your favorite language has a code of conduct in its official website, it's shit tier
>>
>>54759934
waste of time
do projects with different languages
>>
>>54759839
>Line 63 is what really confuses me. It gets called every single frame. He's adding a new object every single tick.
Have you confirmed it's actually doing that or is that what you think it's doing? If I'm reading it right, it will only create the new object if the ID doesn't exist already.
BTW that code is shit and needs to be refactored. At the very least you should have a function to get the object using its ID.
>>
>>54760100
Save a copy for yourself
>>
>>54759873
how is it undefined behavior and if it's undefined behavior what's stopping gcc from outputting the same as icc with -fstrict-aliasing like older versions of gcc
>>
>>54760100
nothing because its not my job to worry about that shit
>>
>>54760100
nothing
>>
>>54760136
but the integrity of the company is at stake? What would happen when the company gets audited?
>>
>>54760117
What kinds of projects then?
>>
>>54760072
Unfortunately, the """argument""" goes like this:
int add(int x, int y)
{
return x + y;
}
>add(INT_MAX, 1) is undefined behavior
>no, it's 0, these 3 compilers generate x86 code that agrees with me!
>the standard says it's undefined
>then why don't you tell the compiler developers to change it?
Eg. this retard:
>>54760133
>if it's undefined behavior what's stopping gcc
These """programmers""" don't understand the concept of undefined behavior but are eager to talk about it.
>>
>>54760156
the most you could do to improve your situation is recommend the people in charge to pay for the extra licenses or maybe talk to the legal dept if your company has one
>>
>>54760156
Would you be held responsible?

>Yes
Go to the supervisor's higher-up
>No
Not your problem
>>
>>54760156
Fair enough. If I had a fair stake in the company and felt I would probably do 'all I can' to protect the company based on how great the risk of audit actually was.
>>
>>54750726
Working on a new personal startpage

Then hopefully to make my first iOS app, just a thing for the notification center
>>
>>54759839
Also, that if on line 56
                if (gameObjects[i]->getID() == ID){
int x = gameObjects[i]->Position()->X();
int y = gameObjects[i]->Position()->Y();
sscanf(data, "1, %d %d %d \n", &ID, &x, &y);
break;
}

Is that supposed to move the object to the position in the message? Because x and y are just local variables there. Did you mean to use references?
>>
>>54760171
it's not undefined behavior, it's perfectly valid for char* to alias any object pointer
>>
>>54760108
https://www.rust-lang.org/conduct.html
https://golang.org/conduct

what's funny is that python's conduct is the only one not taken from SJWs and doesn't include the mentally ill
https://www.python.org/psf/codeofconduct/

c++, haskell, racket, etc, are clean
>>
>>54759833
the way they currently compile the first function in >>54753222 is less efficient than the second function, and it's probably because of how the standard is written
>>
>>54752080
base_url = '/'.join(url.split('/')[0:3])

Wa-la
>>
>>54760119
Yeah, you're right, only 1 item is getting added, my mistake.
Another thing is that I can't get it to update the player that's connected from the internet. Both players can move on their own copies of the game, but only the one that was originally made on that copy is shown as moving, the other stays still. I'm not sure where it is that he's getting the new x/y position, I'm pretty sure it's at line 59, but when I set the GameObject's position to those values, it doesn't move.
And I apologize if you can't understand what I'm saying. My brain is totally fried right now so I'm having trouble putting my thoughts into words.
>>
>>54760193
>I don't understand why it's undefined even after I was told 20 times
>not surprising, considering I base my understanding of the language on compiler output instead of reading the standard and thinking
>but char* tho! char* can alias anything!
you shits are a waste of time, enjoy your incompetence
>>
>>54760327
Did you see my other reply? >>54760191
I think this is your problem. (At least one of them)
>>
File: goattroubles.jpg (250 KB, 707x729) Image search: [Google]
goattroubles.jpg
250 KB, 707x729
>>54760328

You can lead a horse to the standard, but you can't make him think.
>>
/dpt/ what are some good small projects I can finish in a matter of days that look good on a job application?
>>
>>54760184
>>54760181
is this ethical?
Thread replies: 255
Thread images: 32

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.