[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 edition
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: 29
File: Clrs3.jpg (50 KB, 420x475) Image search: [Google]
Clrs3.jpg
50 KB, 420x475
Algorithms Edition

thread_t *prev = >>55007919 ;
>>
>Dont know if it is rude to report something but I posted this right when the new one was created so here it goes:

Can someone help me with this, I am new to C++ and have no idea what Im doing.
I use this code
DWORD color = 0;
BOOL opaque = FALSE;
HRESULT hr = DwmGetColorizationColor(&color, &opaque);
if (SUCCEEDED(hr)) {return color} else {return 0}


My issue is that in the documentation it states:
>pcrColorization [out] A pointer to a value that, when this function returns successfully, receives the current color used for glass composition. The color format of the value is 0xAARRGGBB.
>The value pointed to by pcrColorization is in an 0xAARRGGBB format. Many Microsoft Win32 APIs, such as COLORREF, use a 0x00BBGGRR format. Be careful to assure that the intended colors are used.

The issue is that I need a COLORREF but I dont know how to convert it.
Any help?
>>
>>55012661
Are you familiar with bitwise operations? Use those.
>>
>>55012672
I have no idea what that is :/
I have never used C++ before and I am only using it to make a DLL for an application in another language. My programming knowledge is very limited.
>>
I think you need to do some bitwise operations to extract the channels of the previous format... then you got your channels in an array of Chars... put them in COLORREF using the same way...
>>
>>55012683
Well look those up. Basically, you want to apply bit masks, shift bits and OR things together.

Some bitwizard will probably figure out something better but that should do it.
>>
>>55012661
>I think you need to do some bitwise operations to extract the channels of the previous format... then you got your channels in an array of Chars... put them in COLORREF using the same way...
>>
Daily reminder: the big dick playa will repeatedly rape your mouth. Better stay away from /dpt/ altogether if you're incompetent.
>>55011919
>>
>>55012731
it doesn't overflow fucking retard
>>
>>55012773
ok total_rem overflows i guess but whatever you're fucking lame and you never bother to explain you're just a weak troll and you've been wrong on multiple occasions
>>
>>55012773
are you mentally ill?
>>55012787
>ok total_rem overflows
of course, why were you so stubborn in the first place?
>you never bother to explain
you asked for inputs, I provided inputs
>just a weak troll
no, I'm an incredibly hung C god
>you've been wrong on multiple occasions
nope, I raped you every time :^)
>>
>>55012832
writing C is deprecated
write in high level languages, and if you need more performance generate C or asm with a custom DSL compiler.

get fucked
>>
>>55012973
>yes you rape me every time
>here's some damage control tho
>it explains why I don't have to know C anyway
your whining is so funny :^)
>>
>>55012994
I know as much C as I've needed to know and have written quite a bit of it. No, I don't read the standard and jack off to it daily. Sorry
>>
>>55012832
kill yourself you were wrong on the aliasing meme
>>
Algorithms you should know, or you're probably a code monkey
>simplex method
>FFT
>ford-fulkerson
>IDA*
>PCA
>gram-schmidt procedure
>burrows wheeler transform
>eigenvalue centrality measure
>support vector machine
Note that these are all highly useful algorithms and not academic masturbation, yet many programmers don't understand these
>>
>>55013148
Just finished your algorithms class, eh?
>>
>>55012832
lmao faggot look who's getting raped now :^)
>>
>>55013014
Next you'll be telling us you use ML or some other functional language. Fucking pervert
>>
>>55013014
>I know less than you
of course
>>55013048
nope, I'm never wrong
>>
>>55013187
as I were saying, you're getting raped repeatedly :^)
>they never learn
>>
File: 8uaNhCb.png (13 KB, 884x629) Image search: [Google]
8uaNhCb.png
13 KB, 884x629
Made a quine in befunge. Liking this language.

0>:# 0# g# ,# 1# +# :# 8# 6# *# `# !# _$@


>Befunge is believed to be the first two-dimensional, ASCII-based, general-purpose programming language.
>>
>>55013205
no you are getting raped dude
>>
>>55013193
fuck you i'm not wasting my time on you

but you were wrong on this one:

int fill(int *x, float *y) {
*x = 1;
*y = 0.5;
return *(char *) x;
}
>>
>>55013210
write a befunge->c compiler
>>
>>55013236

The befunge->c compiler should be written in befunge, right?
>>
>>55013236
>Befunge is a two-dimensional fungeoidal (in fact, the original fungeoid) esoteric programming language invented in 1993 by Chris Pressey with the goal of being as difficult to compile as possible.
>the goal of being as difficult to compile as possible
I think I'll pass.
>>
>>55013148
> burrows wheeler transform
know this one

> FFT
heard of this one but know it that well
>>
>>55013266
pussy lmao
>>
>>55013260
Are you still Racket Rocket?
>>
>>55012631
I want to get into programming, however I only know Visual BASIC. What languages would you guys recommend studying and learning on Code Academy.
>>
>>55013193
Du vet ikke hva du snakker om.
>>
>>55013297
Might as well move to C#.

You'll be in a familiar environment with a widely-used cross-platform language.
>>
>>55013297
Du bor lære deg Idris.
>>
>>55013314
>NET is cross platform!
triggered
>>
>>55013283

'Fraid not. I have returned my /SharpShill/ ways. It's just so comfy.
>>
>>55013243
no u
>>
>>55013325
.NET is cross-platform.
>>
What's a good beginner project for JAVA? Something long term
>>
>>55013330
Now, is this C# or F#?

One is a capital offense, the other is a penance.
>>
>>55013274
don't know it that well*
>>
>>55013343
a game with opengl graphics
>>
>>55013314
Gotta 2nd this. I was actually making shit in Visual C# almost as fast as VB because the curve for switching over is low
>>
>>55013330
are you still an religious-anarcho-capitalist-statist?
>>
>>55013343
Du kunne bygge et program for å stjele passord fra lærerne dine.
>>
>>55013385

God bless, y'all. Religion is a stain on society. Bless the soldiers. End the state.

>>55013349

I'm assuming the one you think is a capital offense.
>>
File: 1353689675974.png (11 KB, 211x246) Image search: [Google]
1353689675974.png
11 KB, 211x246
>>55013390
Du mener som en nokkel logger? Men det ville være uetisk!
>>
>>55013401
>purposefully being vague
c or f, it's 1 letter, type it and hit the enter button.
>>
File: programming.png (319 KB, 740x926) Image search: [Google]
programming.png
319 KB, 740x926
>>55013230
>>55012832
Learning C is good, just don't forget anon, that the only reason to learn C CURRENT_YEAR is to know what a decent programming language can't be at all. It is an embodiment of human mistakes. Be smart, don't make mistakes that people have been doing for 50 years.
Use Rust and only Rust if you want to make a high performance software, my m8. In other cases, there are a lot of variants, depends on your OS and deviations.
>>
>>55013429

C#
>>
>>55013314
So C#
>>55013324
Then Idris?
>>
>>55013454
>Idris
Don't bother, it's a bad meme.
>>
File: 1465586807125.png (372 KB, 740x926) Image search: [Google]
1465586807125.png
372 KB, 740x926
>>55013434
pretty close a few times.
>>
File: programming-bingo.png (372 KB, 740x926) Image search: [Google]
programming-bingo.png
372 KB, 740x926
>>55013434
>>
>>55013410
Jeg sa ikke at du *bor* gjore det.
>>
File: wew.png (189 KB, 740x926) Image search: [Google]
wew.png
189 KB, 740x926
Meh, could be better. I should start contributing to free software communism projects.
>>
File: FUG.png (316 KB, 425x450) Image search: [Google]
FUG.png
316 KB, 425x450
>>55013518
FUG
>>
>>55013434
What do I win if I got all of them?
>>
>>55013563
a pic of your favorite trap
>>
File: 2016-06-10 22.34.57.png (515 KB, 740x926) Image search: [Google]
2016-06-10 22.34.57.png
515 KB, 740x926
>>55013434
If you've done a CS degree you will probably have most of them
>>
>>55013542
Jeg bruker Scala hver dag, og jeg tror at det er mye bedre enn C#. Hvis jeg måtte bruke C#, ville jeg bli gal.
>>
>>55013614

Why be mad? C# is very good.
>>
File: welp.png (367 KB, 789x926) Image search: [Google]
welp.png
367 KB, 789x926
What's exactly meant by selfbootable code?
>>
how do you keep your loops from getting convoluted?

for example I have within a loop:
however I only want to check for the 'ul' tag when it follows a certain h2 category but is before another h2 category
I can do this with a boolean but It won't be very readable if I do that

if tmp[:3][1:] == 'h2':
h2text.append('1' + element.text)
elif tmp[:3][1:] == 'h3':
h2text.append('2' + element.text)
elif tmp[:2][1:] == 'p':
h2text.append('3' + element.text)
elif tmp[:3][1:] == 'ul':
print(element)
>>
>>55013614
>I use Scala every day, and I think that it is much better than C#. If I had to use C#, I would be crazy

Fuck off with your communist language, dork.
>>
>>55013643
Something that gets loaded by the BIOS of UEFI. Like a boot loader.
>>
>>55013628
trait Applicative[F[_]] {
def pure[A](a: => A): F[A]

def ap[A, B](fa: F[A])(f: F[A => B]): F[B]

def map[A, B](fa: F[A])(f: A => B): F[B] = ap(fa)(pure(f))
}


Du kan ikke skrive det på C#, det er umulig.
>>
>>55013676
Oh man, how does one get into that?
>>
>>55013230
>not wasting my time on
codewords for "i dont want to get raped again"
>but you were wrong on this one
nope, I was 100% right, like always; you got rekt hard tho
>>
File: bingo.png (434 KB, 740x926) Image search: [Google]
bingo.png
434 KB, 740x926
>>55013434
I guess I should probably just finish off the image
>>
File: 1465586807125.png (381 KB, 740x926) Image search: [Google]
1465586807125.png
381 KB, 740x926
>>55013701
idk
take a look at the source code of this, it's a (safe) boot loader
http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/

>>55013434
this is what I get for taking one CS course and learning everything on my own
>>
>>55013724
>2D/3D graphics
>no GUI

what
>>
>>55013667
Ikke gråt selv om du er dum.
>>
>>55013740
I've never written a mouse driven gui before. I assume that's what it means.
>>
>>55013676
I don't think it only means that... but I dunno

>>55013434
what if I've done many of these things, but in a rather large time frame, and only in very small projects?
>>
>>55013701
http://os.phil-opp.com/
I think there are many others.
>>
>>55013148
>FFT
min 6 semesters of math to implement it
no thanks
>SVM
more like Support Meme Machine, amirite
>>
>>55013722
kill yourself idiot

https://archive.rebeccablacktech.com/g/thread/S54750726#p54753222
https://archive.rebeccablacktech.com/g/thread/S54750726#p54760649

>Oh, so it's an argument about restrict. Yeah, no, it's going to fetch after doing the stores in order, in the first example that is.
>The second example could just return the first byte of 1 and do the stores in any order.
>/dpt/ is retarded.

you just got raped
>>
>had a Linux laptop
>use an OS X laptop at work
>currently use a Windows laptop

Why does developing on Windows feel like dragging my dick across a mile of broken glass, while it's smooth on the other 2? With such huge support, and huge userbase, why aren't there more tools like cygwin that will help emulate not using Windows without actually having to suffer through a VM
>>
>>55013922
what are you even talking about

what language is this?
>>
Is D the best choice if I want the power and speed of C but the comfiness of Python?
>>
>>55013846
>you just got raped
WOW WHY DO UH AVE TO USE THA WORDE RAPE ??? TRIGGERED
>>
>>55013972
you're filth
>>
>>55014001
nice tits whore
>>
File: 1464967629001.gif (3 MB, 360x203) Image search: [Google]
1464967629001.gif
3 MB, 360x203
If I wanted to gift a book for a programmer which one should I pick?

Or is it useless since he uses a kindle.

(thinking of pocket python)
>>
File: 1365524296497.jpg (21 KB, 324x309) Image search: [Google]
1365524296497.jpg
21 KB, 324x309
>>55014025
>>
File: dream_7e0b9460a5.jpg (208 KB, 740x926) Image search: [Google]
dream_7e0b9460a5.jpg
208 KB, 740x926
>>55013612
>>
>>55014029
don't
>>
>>55012661
You could cast the 0xAARRGGBB variable into a BYTE[4] and then zero the value of the alpha channel and swap the RR and BB value, then you'll have 0x00BBGGRR, which you can cast into a COLORREF.
>>
>>55013922
Hvorfor kan du ikke installere Linux?
>>
>>55014029
haskellbook.com
>>
>>55014029
The Art of Computer Programming
>>
>>55014086
I don't speak muslim
>>
>>55014170
so original anon xD
>>
File: trolley problem.jpg (84 KB, 696x960) Image search: [Google]
trolley problem.jpg
84 KB, 696x960
Interested to see how a programmer would approach this problem.

Do you pull the lever, /dpt/?
>>
>>55014170
Lo siento, José. No sabía que eras Americana.
>>
>>55014170
build wall paco
>>
File: 1463436909173.jpg (70 KB, 600x581) Image search: [Google]
1463436909173.jpg
70 KB, 600x581
>>55014201
even harder test
>>
>>55014170
haha my friend have an upboat xD
>>
File: phil.jpg (12 KB, 194x212) Image search: [Google]
phil.jpg
12 KB, 194x212
>>55014227
>>
>>55014227
>>55014201
can we not derail the thread thanks
>>
>>55014201
Why does it matter if they die now or a few years or decades later? End result is the same.
>>
>>55014248
>derail
heh
>>
>>55014248
>derail
minor kek
>>
>>55014201
this can be a simple RNG scenario you accept 5 deaths or see if a random function will try to kill the lowest number of people
>>
>>55014259
Good point, as far as we know if the tram doesn't kill them, they'll just be left tied up until they die of dehydration.

The humane thing to do would be to rearrange the tracks and make sure they all get run over.
>>
>>55014201
>let it run over the 5 normies
>push trolley back
>pull the lever
>rinse and repeat
>>
>>55013297
Skip Codecademy. It's designed for people with little motivation to actually study programming and its content is lacking. They're also starting to put implement a paywall.

Just pick a language, google recommended literature, pick a book and work your way through it. Have goals, and making a AAA game by yourself is not a realistic goal.
>>
>>55014332
>those normies xD
>>
Testing.
blabla code
asd
>>
>>55014201
I remove myself from the situation. It's a choice between actively participating in someone's death or allowing people to die through inactivity. I'm directly responsible for only one of those scenarios.
>>
>>55014504
du knullet en sau i går
>>
>>55014535
Why do you speak this language to me?
>>
>>55014535
I don't speak nigger
>>
>>55014569
hvorfor sier du ting på engelsk til meg?
>>
>>55014591
Hvordan ved du hvor jeg er fra?
>>
>>55014584
men du skriver på det
>>
>>55014604
jeg tror at du kommer fra et mork land
>>
I made a little bash script that searches for GPS coords in all files in directory via exiftool and converts them into Google Maps coords so location can be seen on Maps.

How did I do ??

#!/bin/bash
# This script checks all files in current folder for GPS coords
# via exiftool and converts them into Google Maps coords to stdout.

function e2g {
arg=$(tr -d " " <<< $1) # Remove spaces
sed "s/deg/°/" <<< $arg # Translate deg to degree symbol
}

files=$(find . -type f)
while read -r file; do
res=$(exiftool "$file")
if [[ $res == *"GPS Latitude"* ]]; then
echo "$file"
long=$(grep -iPo "(?<=GPS Longitude : ).*" <<< "$res")
lat=$(grep -iPo "(?<=GPS Latitude : ).*" <<< "$res")
long=$(e2g "$long")
lat=$(e2g "$lat")

echo " $long $lat"
fi
done <<< "$files"

echo "Done with all files."
>>
>>55014679

Neat.
>>
>>55014679
post some examples of files so i can test this script
>>
>>55014877
http://ptforum.photoolsweb.com/ubbthreads.php?ubb=showflat&Number=29893
>>
>>55013846
>the retard that mindlessly contradicted you without any evidence seemed trustworthy even without presenting any proof
please, you're the one that gets rekt every time :^)
>>
>>55014955
m8, i said files not a website, post on pastebin or something
>>
File: 1024-2006_1011_093752.jpg (205 KB, 1024x768) Image search: [Google]
1024-2006_1011_093752.jpg
205 KB, 1024x768
>>55014975
this is from the website, try it on this
>>
>>55014963
your stance on the issue is wrong. if you believe it's right why don't you ask the gcc people to revert their "fix" - i'm sure they'd be interested in this easy optimization as long as it's compliant with the spec.
>>
>>55013148
I know almost all of them and I'm still a code monkey

>>55013834
>min 6 semesters of math
yeah, 6 semesters of basic, compulsory math.
>>
>>55014975
Hell, try the tool in your base pictures folder. You might find some pictures have EXIF data, depending on how big your folder is.
>>
>>55015000
>I don't understand the standard but check out this specific compiler version output
and you wonder why you get your mouth raped
will you ever learn? :^)
>>
>>55015010
not him but it's pointless to implement FFT if you don't have any direct need for it
>>
>>55015078
the standard says that char* can alias any object pointer fucking retard, you're the one who doesn't understand it

and like i said i'm not going to waste my time on you
>>
>>55014992
man got a lot off errors trying to run your script

a.sh: 5: a.sh: function: not found
a.sh: 6: a.sh: Syntax error: redirection unexpected


in bash you define functions like this

function stuff() {
}

#or

stuff() {
}



Also , you should put at the top
 #!/usr/bin/env bash 
>>
>>55014992
4chan strips the EXIF metadata

>>55014679
nice
>>
>>55015136
WTF - since when does 4chan strip EXIF data? I remember people getting exposed on /b/ via exif. Is it removed on all boards?

>>55015117
I'm a bash noob. I'm just using ubuntu here, works fine for me.
Also the script can definitely be improved I'm sure. It's really slow.
>>
>>55013972
no thats the definition of golang
>>
>>55015209
Except golang is shit, it doesn't even have generics
>>
>>55015176
>I'm a bash noob. I'm just using ubuntu here, works fine for me.
>Also the script can definitely be improved I'm sure. It's really slow.

well i can't test your program then. what a shame
>>
is this code any good?

http://pastebin.com/r1WtYu21
>>
>>55015227
>'comfiness' of Python
it's supposed to be shit
>>
>>55015240
>python
No
>>
>>55015227
>muh generics
>>
>>55015238
What kind of environment are you in?
Has anyone here other than me been able to test my script?
Also, I looked to
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-8.html
for making bash functions. It doesn't state anything about there needing to be () in it, as you say. Where do you get this from?
>>
>>55015107
it also says int and float can't alias but apparently you don't know ; that's why your mouth gets used like this :^)
>>
there is no excuse for using python for anything "serious", except for webdev where it's preferable to use python over fucking php and js. python is a shitlang that is used by some schools as a babby's first learner lang because millennial students are retarded so their classes need to be seriously dumbed down, but even then, python is like the year 1 starter lang and then you move on to java or C++.
>>
File: Screenshot - 100616 - 22:30:57.png (88 KB, 983x601) Image search: [Google]
Screenshot - 100616 - 22:30:57.png
88 KB, 983x601
>>55015280
i'm using linux and i can't test your program

i'm using bash as terminal

pic related
>>
>>55015298
Jeg liker deg.
>>
>>55015298
>>55015253
>>55015252
rude

python is so nice and easy you hate it just to be contrarian
>>
>>55015262
Well, they're important.
>>
>>55015298
>Waaaa Python is too easy
>>
>>55015317
Well, shit. What distro - linux mint, ubuntu, etc.? Maybe "bash" differs across distros?
>>
>>55015328
i know. i said "No." because i'm a fucking pleb with no friends and wanted to feel superior for a few seconds.

sorry.
>>
>>55015328
I wrote a compiler for the fucker.
>>
>>55015337
Well, they're not.
>>
>>55015349
ubuntu 12.04
>>
>>55015317
Maybe you can try to not load the script in that bash prompt but just do ./a.sh in the terminal? That's how I use it.
>>
>>55015292
it could be a union of int and float. you're getting raped hard

>If the member used to read the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called ‘‘type punning’’). This might be a trap representation.
>>
>>55015360
Have to disagree there, old chap. Having generics leads to parametricity, which leads to free theorems.
>>
>>55015391
>muh theorems
>>
>>55015381
hmm interesting. i tried that and got

./a.sh: line 12: exiftool: command not found
./a.sh: line 12: exiftool: command not found
Done with all files.

>>
>>55015339
try executing this buddy
tmp=['Where','Did','My','Elements','Go?']
new_array=tmp
print(new_array)
print(tmp)
for element in tmp:
tmp.pop()
print(new_array)


what a joke
>>
>>55015391
Nice buzzwords m8.
https://en.wikipedia.org/wiki/KISS_principle
>>
>>55015401
>muh no argument
>>
>>55015407
you need to install exiftool:
sudo apt-get install exiftool
>>
>>55015427
yeah i know that, but
E: Unable to locate package exiftool


i don't really care tho, if someone got the script working good for them and good for the creator of the script
>>
>>55015409
are you, by any chance, retarded?
>>
>>55015464
Well, shit. Maybe you need to do an sudo apt-get update too. Nevermind then.
>>
File: 1412511162187.png (64 KB, 200x200) Image search: [Google]
1412511162187.png
64 KB, 200x200
>>55014227
>>
>>55015409
you have to copy the array, dumbass. instead of new_array=tmp, use new_array=tmp[:]
>>
>>55012631
Hey /g/, i'm currently working on a project to create a smartphone app that predicts specific user behaviour.
The algorithm will be based on machine/self learning.
I have to use rails as backend, but want to integrate pythons scikit since ruby doesn't offer what i need.
Are there any /g/ approved guides or books for rails/python/scikit/android apps or machine learning in general?
>>
>>55015569
yes I know WHY it happens
>>
>>55015409
for element in tmp:
tmp.pop()

hmm... yeah, this is kinda stupid, wtf python...

>>55015605
you are actually mixing two issues, imo
>>
>>55015589

not sure if this helps but

https://github.com/josephmisiti/awesome-machine-learning
http://scikit-learn.org/stable/
>>
r8 babby's first attempt at programming
tell me why it's shit besides the concept

http://pastebin.com/eCQCccA8
>>
>>55015815
>You're a bit too young in development. When looking at your income, you're at risk of not being able to afford everything you need. Raising a child is challenging, but raising a child without a partner will be even more so...

;_;
>>
here, x and y may be assumed not to alias each other according to the strict aliasing rules:

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


but since the example below has a cast to char*, and char* is allowed to alias any object pointer, the stores must be done in order and the result must be fetched:

int fill(int *x, float *y) {
*x = 1;
*y = 0.5;
return *(char *) x;
}
>>
>>55011078
How's that homosexual exactly?
>>
How can I tell if I'm an expendable glue code developer?
>>
>>55015815
I'd
- add some exception handling in lines 1-5, for when int(string) can't convert the input string
- pass rel.lower() to shouldrel, so that the user can enter single/couple/married in upper/camel case and it'd be still valid input.
>>
How come this general doesn't have a pastebin for books/learning guides or anything?
>>
>>55015970
I tried putting links in the OP once, but got sperged on
Look in shodan.me/books or it-ebooks
>>
>>55015386
see? you're a retard; now you're claiming that ANY int can alias ANY float because somewhere there might be a union that contains an int and a float; you're too shit to even understand what you're fucking reading; you're so shit that you believe there are no aliasing rules anyway, because "but muh unions and muh char*"
how many more times do I need to stretch your mouth?
>>
So I've checked around how pow() is implemented in C (which seems to be used by other languages), and it appears to be O(1), at least for implementations on x86(-64) architectures. Thus, computing fibonacci numbers using the formula is O(1).
>>
>>55016018
see >>55015879

it's very simple. the same principle applies as in

int fill(int *x, float *y, char *z) {
*x = 1;
*y = 0.5;
return *z;
}
>>
>>55015879
>here, x and y may be assumed not to alias
b-but muh union, right shitsperg?
>but since the example below has a cast to char*
how do you know there's no cast to char in the previous example? you need to show the entire code to be safe, amirite?
>the stores must be done in order
really? if there's a char* somewhere in the program, all loads and stores EVERYWHERE must be done in the order they appear in the source and all optimizations disabled? are you aware you might be mentally ill?
>>
>>55016088
literally retarded. if there's a char* being dereferenced after the call to fill, then yes of course it has to be fetched, unless the char* was declared with the restrict keyword, idiot.
>>
>The Custom date range search is broken for more than 2 years!!
now more than 3 years

google is fucking shit
>>
>>55016000
>shodan.me/books
huh, nice. thanks m8

>>55016145
>>The Custom date range search is broken for more than 2 years!!
>now more than 3 years
:(
I tried it a while ago, and it worked. you sure you are using julian(?) dates?
>>
>>55015663
Thanks, looks interesting.
>>
File: want39542-1Ponaw1464996569.jpg (42 KB, 512x512) Image search: [Google]
want39542-1Ponaw1464996569.jpg
42 KB, 512x512
how can i make a instagram account if i don't have a smartphone , iphone?

does anyone have a spare one?

i need to test something
>>
>>55016088
>literally retarded.
thanks for at least admitting to that
>then yes of course it has to be fetched
did anyone claim otherwise? are you also illiterate?
>unless the char* was declared with the restrict keyword
if you use restrict there's no need for memory fetches? what the fuck are you even talking about? how fucking stupid can you be?
>>
>>55016312
actually >>55016121
>>
>>55016291
i'm clicking the date picker that pops up and it says 10 AD or someshit. if i set a 'from' date to present it includes old results. if i also set a 'to' date it gives no results.
>>
I want to make a roguelike but have no clue where to start. Do you write the combat logic first then the display stuff after?
>>
>>55016312
https://www.youtube.com/watch?v=tHioEC9itTg

take it to the gcc and clang people or have fun getting the "wrong" compilation results in your programs lol
>>
>>55016337
ok it works on google.com, i have to go to google.com/ncr (no country redirect)
>>
>>55016363
>take it to the gcc and clang people
why?
>getting the "wrong" compilation results in your programs
what are they doing wrong?
>>
>>55016470
they do the fetch (and no reordering) in the second example in >>55015879
>>
Programmeringsspråket ditt er dårlig.
>>
>>55016504
>they do the fetch (and no reordering)
so? why do you think it's wrong? or why do you imply that I think it's wrong? did I say they have to reorder? do you understand logic? how about the difference between IS ALLOWED and IT HAS TO?
really, how fucking retarded do you have to be?
>>
>>55016564
it's a trivial optimization and gcc used to do it, but they made an active decision not to do it in order to adhere to the standard. note that they don't do the fetch in the first example. if they were allowed to, they would avoid the fetch in the second example as well.
>>
also, note that they don't do the fetch in

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


the difference in compilation output is clearly because of the strict aliasing rules
>>
>>55016594
>they made an active decision not to do it in order to adhere to the standard
did they actually tell you that? or do you assume? keep in mind you got thoroughly raped on previous assumptions
>if they were allowed to, they would avoid the fetch
that's your entire reasoning? "why doesn't the compiler do it like this?" because it doesn't have to! it can do whatever it wants as long as it doesn't break the standard!
>>55016644
>the difference in compilation output is clearly because
how is it """clearly because"""? because you assume it to be the reason? it's IMPOSSIBLE to be the result of changes in the optimizer?

how about this, why doesn't the compiler simply optimize to return 0? does that mean always returning 0 is wrong? you're in over your head, moron, you don't have a fucking clue what you're talking about
#include <limits.h>

int always_0(int x)
{
if (x == INT_MAX) {
return x + 1;
}
return 0;
}

inb4
>this is clearly because int must wrap around when it reaches the upper limit!
you're beyond fucking retardation
>>
>>55016975
INT_MAX + 1 is likely undefined
>>
>>55017015
>likely
you mean there's a chance it's not? do you even know C?
>>
>>55016975
how can you be this fucking retarded

for the first part you're simply wrong, the standard explicitly says char* can alias any object pointer

the second part is just ridiculous and you better be trolling
>>
>>55016975
also since i'm not entirely sure if you're trolling or just retarded i'll explain: INT_MAX + 1 would be INT_MIN on the typical two's complement implementation, not 0, FUCKING RETARD
>>
>>55017045
Do you?
>>
>>55017080
>'ll explain
there's no need, you can't because you don't know anything
hint: it's always undefined
>>
>>55017098
not an argument.

the examples with the fill functions do not contain UB

KILL YOURSELF FUCKING MORON
>>
>>55017098
undefined argument
>>
>webshit that doesn't know INT_MAX + 1 is undefined tries to argue aliasing rules with the big dick playa
you can't make this shit up :^)
>>
>>55017122
>big dick playa
>:^)
>>>/b/
>>
>>55017122
i do know that it's undefined you fucking delusional moron, it's your incoherent argument that doesn't make any sense and is completely irrelevant and doesn't prove anything about your stance on the strict aliasing issue

the standard explicitly says char* can alias any object pointer

the standard explicitly says char* can alias any object pointer

the standard explicitly says char* can alias any object pointer

KILL YOURSELF
>>
>>55017055
>for the first part you're simply wrong, the standard explicitly says char* can alias any object pointer
I never said otherwise
>the second part is just ridiculous
you were the moron that tries to prove his claims with compiler output, are you backpedaling now?
>>
>>55017122
why is INT_MAX + 1 undefined?
>>
>>55015317
I believe this is because you're running `sh a.sh`, when the syntax
function e2g() {

}

is non-portable and bash-specific?

Instead, try
etg() {

}

Or invoke with bash.
>>
>>55017141
>i do know that it's undefined
yes, now that I slapped you mouth with my dick, you do; previously, you clearly didn't >>55017080
>>
>>55017152
you're dumb as shit stupid sperg

>>55015879 is entirely correct
>>
>>55017161
because the standard says so
>>
>>55017169
>would be
fucking delusional retarded sperg, you're just believing what you want to believe with no connection to reality
>>
get a fucking life stupid sperg, your trolling was mildly amusing when you actually has a point like with averaging two ints in C, but on this one you're dead wrong
>>
>>55017192
undefined argument.
>>
>>55017169
to be fair, he did say
>typical
anon. This is usually true, although you're completely correct this is undefined behavior.

A lot of shitty CS programs don't teach that.
>>
>>55017172
>no more arguments now that "muh compiler output" got rekt
>but these statements backed by compiler output are correct tho
you don't even realize why you're an idiot
>>
File: Sif.gif (35 KB, 230x200) Image search: [Google]
Sif.gif
35 KB, 230x200
The shitflinging level is p. high tonight
>>
>>55017213
it's backed by the standard you complete fucking moron, the compiler outputs were just to demonstrate it in practice since you didn't believe the point about the standard
>>
>>55017218
it's been getting a lot higher lately.

Not doing a lot of programming at home these days since I started an internship. At work I'm currently building a system that allows remote management of our IOT technologies.
>>
File: i trol u.png (85 KB, 1264x904) Image search: [Google]
i trol u.png
85 KB, 1264x904
friendly reminder that /dpt/ sucks fucking ass and has some really pathetic trolls
>>
>>55017206
>trolling was mildly amusing when you actually
m8, I raped your sorry ass over and over again; face it: I'm better than you and at this rate, I'll always be
>but on this one you're dead wrong
you shits make that claim over and over again and you get told over and over again
keep being retarded
>>
mentally ill person: >>55017248
>>
>>55017221
>compiler outputs were just to demonstrate
so compiler output demonstrates the standard? it clearly doesn't do that in the INT_MAX + 1 example
>>
>>55017265
Not an argument.
>>
repeatedly rekt person: >>55017265
>>
holy shit you're pathetic kill yourself seriously
>>
ITT: a bunch of spergs arguing about the C standard instead of building software.

First the autists discovered Video Card Benchmarks, now they have the C Standard.
>>
>>55017218
Yeah, there are still some inexplicably clueless morons that think they know more than the big dick player.
>>
>>55017308
weak bait
>>
>>55017306
>a big dick playa filling the mouths of idiots that don't know the C standard
ftfy
>>
>>55017242
kek that's pretty good trolling
>>
>>55017315
Just stating obvious facts.
>>
>>55017321
have fun wasting your time on "trolling" fellow trolls
>>
this thread is cancer
>>
>>55017335
ok so gcc and clang are much more inefficient than the standard allows, good to know
>>
Functional > OOP > imperative > dynamic
>>
>>55017368
dynamic functional & imperative > all
>>
>>55017368
stay delusional
>>
>>55017383
me > you
>>
>>55017383
gradual*, rather

>>55017388
how can I be > myself?
>>
>>55017383
Why catch errors at compile time when you can defer them until runtime?
>>
>>55017408
i meant gradual typing
>>
>>55017361
Clearly. But that can improve. Just don't rely on the current implementation and you'll be fine (like some people relied on memcpy copy-ing from front-to-back and were outraged when glibc changed the copy direction to back-to-front because it was more efficient on new architectures).
>>
>>55017427
Nope. Gradual typing is for web pajeets.
>>
>>55017449
Are you retarded?

Static typing is a subset of gradual typing
>>
>>55017454
Why bother having the compiler check all of your code when it could check part of it?
>>
>>55017440
idiot
>>
char* can alias any object pointer, hence the char* in the fill function can alias either x or y, end of discussion
Thread replies: 255
Thread images: 29

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.