[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: 24
3D waifus edition

Old:
>>52120099
>>
FIRST
>>
>>52125780
what do you think she is thinking about in that picture?
>>
>>52125780
import faggot
print "op is a faggot"
>>
>>52125804
optimizing subroutines for a fast fourier transform
>>
>>52125812
You have an unused import

Python 2 is obsolete

2/10
>>
Wew.
>>
>>52125780
<html5>
op is a faggot<endl>
</html5>
>>
What have you guys coded in Go this Christmas?
>>
>>52125780
<?php>op is a faggot</php>
>>
>>52125886
an automated installer for google chrome
>>
« → A N
«
IF N 0 ==
THEN A
ELSE A N * N 1 - FAC
END
»
»
>>
>>52125886
The program "kill yourself". When you run "go kill yourself", it uninstalls go and installs a good language before deleting itself.
>>
>>52125938
post the github link
>>
N O G F
O O
G ᠎ ᠎ ᠎ ᠎ G
F ᠎ ᠎ ᠎ ᠎ ᠎ ᠎ ᠎ ᠎ F
>>
>>52125955
Too late, I used it just after I finished writing it.
>>
Raymarch bro here.
#include <math.h>
#include <algorithm>
#include <string>
#include <pmmintrin.h>
using namespace std;typedef float R;
#define _W 79
#define _H 39
#define EP 0.01f
#define OP operator
#define C const
#define E return
#define PQ M*(3.1415f/180)
union J{__m128 V;J(__m128 V):V(V){}J(R X,R Y,R Z):X(X),Y(Y),Z(Z){}struct{R X,Y,Z;};R L()C{E _mm_cvtss_f32(_mm_sqrt_ss(_mm_dp_ps(V,V,0x71)));}J N()C{E _mm_mul_ps(V,_mm_rsqrt_ps(_mm_dp_ps(V,V,0x7f)));}R D(C J& O)C{E _mm_cvtss_f32(_mm_dp_ps(V,O.V,0x71));}J A()C{E J{abs(X),abs(Y),abs(Z)};}J OP+(C J& O)C{E _mm_add_ps(V,O.V);}J OP-(C J& O)C{E _mm_sub_ps(V,O.V);}J OP*(C J& O)C{E _mm_mul_ps(V,O.V);}J OP/(C J& O)C{E _mm_div_ps(V,O.V);}J OP+(C R& O)C{E _mm_add_ps(V,_mm_set1_ps(O));}J OP-(C R& O)C{E _mm_sub_ps(V,_mm_set1_ps(O));}J OP*(C R& O)C{E J{_mm_mul_ps(V,_mm_set1_ps(O))};}};R BX(C J& P,J B){J D=P.A()-B;E min(max(D.X,max(D.Y, D.Z)),.0f)+J{max(D.X,.0f),max(D.Y,.0f),max(D.Z,0.0f)}.L();}R RB(C J& P,J B,R R){E BX(P,B)-R;}J RY(C J& P,R A){E J{P.Z*sin(A)+P.X*cos(A),P.Y,P.Z*cos(A)-P.X*sin(A),};}J RZ(C J& P,R A){E J{P.X*cos(A)-P.Y*sin(A),P.X*sin(A)+P.Y*cos(A),P.Z,};}static size_t M=0;R Q(C J& P){R D=P.Y+2;D=min(D,RB(RY(RZ(P,PQ),PQ),J{2,2,2},0.5f));E D;}J Nor(C J& P){E J{Q(P+J{EP,0,0})-Q(P-J{EP,0,0}),Q(P+J{0,EP,0})-Q(P-J{0,EP,0}),Q(P+J{0,0,EP})-Q(P-J{0,0,EP}),}.N();}R Y(C J& O,C J& D,bool* H){R T=0;for(size_t i=0;i<128;i++){R Y=Q(O+(D*T));if(Y<EP){*H=1;break;}T+=Y;}E T;}R B(C J& O,C J& D,R U,R I,R K){R S=1;for(R t=U;t<I;){R di=Q(O+D*t);if(di<EP){E 0;}S=min(S,K*di/t);t+=di;}E S;}int main(){J LD=J{0.5,1,0.25}.N();J G=J{0,1,-8};string S;S.reserve(_W*_H);do{M++;for(size_t y=0;y<_H;y++){for(size_t x=0;x<_W;x++){J K(x,y,1);K=K/J(_W,_H,1);K=(K*2.0)-1;K.Y=-K.Y;K.X*=_W/_H;K.Z=R(1/0.726);K=K.N();bool H=0;R Z=Y(G,K,&H);J P=G+(K*Z);if(H){J N=Nor(P);R D=N.D(LD);D*=0.5;D+=0.5;D*=D;D*=B(P,LD,R(0.5),10,10);S+=".:*oe$&#%@"[static_cast<size_t>(D*10)];}else{S+=' ';}}S+="\n";}printf("%s",S.c_str());S.clear();}while(M<360);E 0;}
>>
Write a program that deletes itself in Haskell
>>
>>52125963
OO is deprecated
>>
>that union
why so obfuscated anon
>>
>you will never have a well-behaved qt3.14159 white gf with thin knees
>>
>>52126013
import System.Environment
import System.Directory

main = getExecutablePath >>= removeFile


What next?
>>
>>52126018
its compact.
had to make it less than 2000 characters to post
>>
WTF happened with Selena?
>>
>>52126081
Haskell proven not pure
>>
>>52126077
Left to right:

Ew
Ew
Ew
Ew
Qt
Ew
>>
Good morning.
>>
This thread is now the legitimate thread. Any new thread will be deleted.
>>
>>52126109

menopause, woman are maturing faster and faster
>>
>>52126128
That code is 100% pure, any side effects happen outside the program.
>>
>>52126109
She isn't relevant anymore.
>>
>>52126128
How so?
>>
>>52126147
Okay but where the fuck is Selena?
>>
>>52126166
MOODS
>>
>>52126166
I wanna shoot a load on that face
>>
>>52126144

>manjaw
>ancient
>qt
>nigger
>butterface
>the invisible woman

FTFY
>>
File: cap.png (352 KB, 623x527) Image search: [Google]
cap.png
352 KB, 623x527
>He calls himself Software Engineer
>>
>>52126259
>3rd, qt
short hair, balding forehead
her eyebrows really wanna join
looks almost like a man's face

>4th, nigger
i'm sure OGTP will love her

>5th, butter face
it's not great but she's leagues above the others
>>
>>52126297
>he doesn't substitute every instance of "[sS]oftware\s+[eE]ngineer[^\s]*" to "[pP]oo in [lL]oo[^\s]*" in his browser
>>
>>52126128
You're just naming a random monad and binding it to a function. The code itself is pure because it never says "delete this", it just so happens that the compiler feels those specific monads and functions look special, and makes it so that the file gets deleted when you run the program
>>
>>52126173
So you can still read the file even if it was "deleted"?
>>
>>52125983

Jesus H. Christ.
>>
>>52126352
>3rd
>short hair
>3rd
It's obviously one of ponytail or bun you dumbass! Lamps do not count as women!
>>
>>52126352
>>4th, nigger
>i'm sure OGTP will love her

No thanks. She isn't very cute.
>>
>>52126376
>naming a random monad
>the compiler feels those specific monads
You're half right but the other half is utter bullshit, anon.
>>
>>52126352
my main complaint about the 3rd one is that she looks kinda manly like she has high testosterone with those facial characteristics and assertive facial expression. her skin looks like it feels kinda manly to the touch, not super soft and smooth like melissa. some guys will probably find her attractive but she's just not my type at all
>>
>>52126396
https://gist.github.com/Wunkolo/249646f7a922ee045c70
>>
>>52126444
Fuckoff, redditard!
>>
I wanna get into Embebbed Systems.

What should I do? inb4 kill myself

From my understanding, C++ is a need.
>>
>>52126427
Can you show me the error of my ways, or are you just nitpicking about my liberal use of the word "random"?
>>
>>52126444

This is some next level shit.
>>
>>52126464
C is used much more than C++
>>
>>52126493
The values of "getExecutablePath" and "removeFile" aren't monads. They're values of "IO String" and "IO ()", which are computations doing something and producing a String and (), respectively. IO is the monad, and all the monad part of it means is that these computations can be sequenced in a particular way with ">>=".

You're right that Haskell remains pure since it is basically a DSL for combining impure computations in a sensible way.
>>
>>52126519
The memes have started
>>
>>52126601
for embedded systems C is probably used more. it depends though because shit's getting cheaper and more energy efficient so you can get away with C++ depending on what you're doing
>>
>>52126601
"x is a meme" is a meme, anon.
>>
>>52126663
>probably
you seem less certain now
>>
>>52126663
>more energy efficient
This interest me very much. Is there a way of comparing which languages need more energy for common shit? For instance, a comparison of energy of loops between C, C++, Python and Java.

Now THAT would be interesting.
>>
Why isn't I/O considered pure? What side effects does it have?
>>
>>52126699
Make one yourself, I would be interested to give it a glance sometime.
>>
>>52126581
Hm, I agree with you. Not sure what I was saying wrong, really though. IO types are pretty much exclusively used in a monadic manner as far as I know, and sure IO is a monad too. Yes, they get merged into one monad that will be the main function's value, but it's still the original monads being special (and consequently the merged monad being "special" too) that makes the compiler put the delete part in the executable
>>
File: slides to.jpg (35 KB, 561x365) Image search: [Google]
slides to.jpg
35 KB, 561x365
What legendary operators does YOUR language use dpt?

Only valid ones
>>
>>52126699
assembly>C>C++>Java>Python
>>
>>52126756
>Java>Python
nice meme
>>
anyone got one of those /g/ roll pics

>>52125983
teach me senpai
>>
>>52126743
pipe forward operator is actually pretty genuinely legendary in F#.
>>
>>52126771
* > python
>>
>>52126699
Empirical tests?

>>52126717
From what I understand, any thing explicitly causing changes in the "outside world", apart from describing how to obtain the result of the program (obviously code execution has to cause changes too, but those don't count because you don't explicitly ask for those changes), is considered as having a side effect.
>>
>>52126771
If python had static compile time checking typing and would be fine. Without it, it's just a meme.
>>
>>52125780

>OP image gets deleted

this is allowed: >>52125677


What an "interesting" board
>>
>>52126771
in terms of energy efficiency, yes
>>
>>52126804
>>52126826
nice memes
>>
>>52126804
Exactly. Maybe the Python docs wouldn't be worthless too with type information
>>
Are people really saying C is anything but the most used embedded language by far

This is just harmful
>>
>>52126807
Mods confirmed for animefags

They probably wank off to lolis
>>
>>52126807
hpg isn't filled with normies that kick and scream to Mum (mods) when they see an image they don't like.
>>
>>52126717
Haskell's IO is a bit of a misnomer, since it encompasses all possible side effects. Even then, just writing data from standard input and writing data to standard output are side effects. Loading and storing values from somewhere in memory are side effects. Anything that isn't "map this value to this value", i.e. a mathematical function/relation, is or has a side effect.

>>52126727
The problem is that you're using the term "monad" incorrectly, which further adds to its "mystique". If it's not a functor with return, join/bind, and the laws, it's not a monad. So IO is a monad, but IO a or any value of that type are not.
>>
>>52126882
>The problem is that you're using the term "monad" incorrectly, which further adds to its "mystique". If it's not a functor with return, join/bind, and the laws, it's not a monad. So IO is a monad, but IO a or any value of that type are not.
Ah, I think I read you. "Monadic value" would be the correct term if I wanted to talk about IO values, right?
>>
File: tadpole.png (1 KB, 235x60) Image search: [Google]
tadpole.png
1 KB, 235x60
>>52126743
>not using tadpoles
>>
>>52126956
Exactly. But there's nothing special about them.

The only thing in common with all the instances of the Monad type class is that they are all instances of the Monad type class. Do you get what I'm trying to say here?
>>
>>52126998
Yeah I do. Thanks for correcting me anon.
>>
File: mfw.gif (1005 KB, 229x188) Image search: [Google]
mfw.gif
1005 KB, 229x188
>>52121209 here, managed to solve it by using

SELECT IFNULL(a.UId,-1) AS UId, IFNULL(a.UName,'Unknown') AS UName, postsquery.Posts AS UPosts, IFNULL(a.UPosts,-1) AS UFakePosts
FROM
(
SELECT p.PId, p.PAuthorId, COUNT(p1.PAuthorId) as Posts
FROM forum_posts AS p
LEFT JOIN forum_posts AS p1 ON p1.PId = p.PId
GROUP BY p.PAuthorId
)
AS postsquery
LEFT JOIN forum_users AS a ON postsquery.PAuthorId = a.UId
ORDER BY
postsquery.Posts DESC

fast as fuck but I would like to fetch the number of threads as well, this is what I've tried but it won't work

SELECT IFNULL(a.UId,-1) AS UId, IFNULL(a.UName,'Unknown') AS UName, postsquery.Posts AS UPosts, threadsquery.Threads AS UThreads, IFNULL(a.UPosts,-1) AS UFakePosts
FROM
(
SELECT p.PId, p.PAuthorId, COUNT(p1.PAuthorId) as Posts
FROM forum_posts AS p
LEFT JOIN forum_posts AS p1 ON p1.PId = p.PId
GROUP BY p.PAuthorId
)
AS postsquery,
(
SELECT t.TId, t.TAuthorId, COUNT(t1.TAuthorId) as Threads
FROM forum_threads AS t
LEFT JOIN forum_threads AS t1 ON t1.TId = t.TId
GROUP BY t.TAuthorId
)
AS threadsquery

LEFT JOIN forum_users AS a ON threadsquery.TAuthorId = a.UId
LEFT JOIN forum_users AS a1 ON postsquery.PAuthorId = a1.UId

ORDER BY
postsquery.Posts DESC


gives me
[Err] 1054 - Unknown column 'postsquery.PAuthorId' in 'on clause'
>>
>>52127036
No problem. I like to chip away Haskell's meme status as much as possible.
>>
>>52126685
>/g/ is one person
>>
>read about SICP
>uses Lisp
how did this meme catch on?
>>
>>52126699
there was a paper where they measured the time and heat energy given off by a smartphone with implementations in java and in C/C++

for some problems C/C++ ran a lot faster and consumed a lot less energy

i don't have the link saved
>>
https://strawpoll.me/6398631
>>
Daily reminder that if your language of choice is not on this list you should probably give up and kill yourself:
- C++
- C#
- Lua
- Python
- Elixir
- Haskell
- Bash
- Clojure
- D
>>
File: hmm, yes.jpg (34 KB, 396x303) Image search: [Google]
hmm, yes.jpg
34 KB, 396x303
>>52127331
>>
>>52127331
Why do you keep posting this list?
>>
>>52127307
Whoever it was voted dynamic..
You're fired.
>>
>>52126878

>normies

What an awful word
>>
File: spongebob.jpg (45 KB, 652x362) Image search: [Google]
spongebob.jpg
45 KB, 652x362
>>52127331
>Posts python
>Dont post Java
>>
>>52127307
What the heck is the point of dynamic typing anyway? Why would I suddenly decide to store a string instead of an int in my i variable?
>>
>>52127331
Reminder that D and Python should not be on that list
>>
>>52126807
even traps are allowed as long as it's 2D like wot
>>
>>52127357
POO
O
O

IN
N

LOO
O
O
>>
>>52127391
>- Lua
>- Python
>- Elixir
>- Haskell
>- Bash
>- Clojure
you're a literal faggot
>>
>>52127383
It's easier.

t. recently graduated fizzbuzzer
>>
>>52127386
D is the most solid language on that list
>>
>>52127413
easier for babby's first fizzbuzz type problems

not easier when you have real applications that involve more than few variables and functions
>>
>>52127383
So you don't needlessly create new variables to represent a different type version of a variable. For example, you might want to have an int that stores a number and you can manipulate it using mathematical functions, but then loop through it using the string representation of it. Having strNumber and intNumber is needless and wastes space on a sizable program

Additionally, storage type have individual restrictions on them for good reason, but you may want to cast them into another type to bypass this restriction.
>>
File: 1450400267716.jpg (30 KB, 475x533) Image search: [Google]
1450400267716.jpg
30 KB, 475x533
>>52127449
>Having strNumber and intNumber is needless and wastes space on a sizable program
it's literally one line of code to declare a strNumber in addition the intNumber
>>
>>52127487
To declare, yes, you absolute nob. Is that all you do with variables? jesus christ laddie
>>
>>52127449
String 5 and Int 5 are completely different things. Besides, you're confusing dynamic and weak typing, both of which are shit BTW
>>
Threadly reminder that you should not refers to the act of programming as coding. It is improper and makes you look like a 15 year old

You are a programmer, not a coder
>>
>>52127535
kill yourself
>>
>>52127487
>it's literally one line of code to declare a strNumber in addition the intNumber
You will double the memory for each variable call, George. If you do this shit with something that uses that line of code intensively, you will lose ALOT of memory quickly. Also, enjoy your memory leak.
>>
>>52127589
How about you kill yourself faggot
>>
>>52127449
>Having strNumber and intNumber is needless and wastes space on a sizable program
The space has to be used somewhere, anon. Also, time is more important than space almost all the time.
>>
>>52127591
>dynamic typing proponent talking about efficiency
lad...
>>
>>52127583
I'm a computer scientist
>>
File: 1405939013031.png (240 KB, 474x351) Image search: [Google]
1405939013031.png
240 KB, 474x351
>>52127591
Are you being serious? The program has to convert "5" to 5 in its binary presentation at runtime either way if you want to do "5" + 5
>>
>>52127583
Is it assburger hour again?
>>
File: coder_projects.jpg (51 KB, 640x250) Image search: [Google]
coder_projects.jpg
51 KB, 640x250
>>52127663
no its CODER HOUR
>>
>>52127687
So it is assburger hour then
>>
>>52127663
assburgers crave attention, just like normies. we should all just ignore him.
>>
File: 1433873647321.jpg (93 KB, 500x375) Image search: [Google]
1433873647321.jpg
93 KB, 500x375
>>52127638
>Has a bachelor
>Thinks he is a scientist
>>
>>52127694
every hour is
>>
>>52127701
he said computer scientist, if you think the individual definitions of words make up the definition of their combined term, you have no grasp of language
>>
>>52127727
And if you have some grasp of language, you are a retarded faggot. If you don't understand, then you are a dumb retarded faggot.
>>
>>52127772
nice rebuttal lmao
>>
>>52127727
HRURR DURR u HAV AUTISM XDDDDD !#
>>
How meme is this F# line?
let bind = ((>>) eval)
>>
>>52127727
a computer scientist is a type of scientist. you can study computer science without being a computer scientist.
>>
Lol why didn't anybody tell me that C had support for a garbage collector?
My code is so yummy now.
#include <stdio.h>
#include <gc.h>
int main()
{
GC_malloc(sizeof(char));
char c = 'f';
GC_malloc(sizeof(char));
char input_buffer_char = 0x0;
GC_malloc(sizeof(unsigned int));
unsigned int i = 0x0;
scanf("%c",input_buffer_char);
i = (int)input_buffer_char;
if((char)i != (char)c)
{
printf("Please format your input properly and try again.\n");
}
}
>>
Its pretty simple.

You say coder, you sound like a 15 year old who has "coded in HTML and CSS"

You say programmer, you sound like a person who has experience writing computer instruction
>>
>>52127804
did I ask for your fucking opinion?
>>
>>52127791
What does eval do?
>>
>>52127838
Confirmed edge lord, perhaps you should head off to /b/, your containment board.
>>
>>52127846

    let rec eval = function
| Value x -> x
| Application (instr, lu, ru) ->
let l = eval lu
let r = eval ru
match instr with
| Add -> l + r
| Mult -> l * r
| And -> l &&& r
| Or -> l ||| r


just messing around
>>
>>52127828
no one ITT called themselves a coder unironically. you're complaining about a complete non-issue.
>>
>>52127828
seriously, who are you quoting?
>>
What does /g/ think about the io language?

http://iolanguage.org/tutorial.html
>>
>>52127813
Well why wouldn't it?
>>
>>52127838
a computer scientist is a scientist who does research in the field of computer science. a person with a bachelor's degree in computer science isn't necessarily a scientist.
>>
>>52127897
looks gay tbf
>>
>>52127897
absolutely shiggylicious
>>
>>52127897
XD IO (input output) !!!! :DDDD
>>
Ok /g/ this is a serious question.

Why do people actually develop on OSX? Why dont they use linux. In all my experiences, OSX is such a pain in the ass to setup a development environment on because of this xcode bullshit. Not only that, but Apple manages to break cmakes for a shitton of libraries every single time a new version of OSX comes out. Not only that, the lack of a centralized repository makes it a pain in the ass to find shit. Yeah you can install brew, but why cant OSX come with something similar by default? Also, why is the terminal so fucking slow on all the macs i use. I've noticed that the cursor speed on osx terminals is so unbearably slow.
If you use linux, everything you need is just there, you dont have to dick around on the internet and spend an hour setting up your development environment.
>>
>>52128001
probably because californian hipster cred and idk what do you mean about dev being PIA since you don't even have to use xcode (or so I think)
>>
>>52128001
the only sane reason would be for developing iOS/OSX-specific shit
>>
>>52128001
Because they want to develop for iOS
>>
File: job-interview.jpg (20 KB, 292x219) Image search: [Google]
job-interview.jpg
20 KB, 292x219
>>52127897
>It says here you program in IO
>What did you mean by this?
I-its a real language called IO haha.
>Don't call us we'll call you.
>>
>>52128044
>they want to develop for iOS
the fuck am I reading
>>
File: 1421290222449.gif (2 MB, 320x240) Image search: [Google]
1421290222449.gif
2 MB, 320x240
>>52127919
How can a computer scientist be a scientist if computer science isn't a science?
>>
What the hell is cython for?
Do you just convert slow parts of your program to C and call it as a library or can you melt a whole python program into executable c?
>>
>>52127386
Reminder that only ocaml and ats should be on that list.
>>
File: 1451354408646.jpg (38 KB, 349x352) Image search: [Google]
1451354408646.jpg
38 KB, 349x352
>>52128063
>Don't call us we'll call you
>>
>>52127897
It doesn't seem to have any consistent theme as far as I can tell.
>>
>>52128066
How can a physicist be respected if phys is icky?
>>
>>52128066
That is the worst gif to support your argument, have you even watched the lecture?
>>
>>52128066
how can a scientist computer if computer isint a computer?
>>
https://beej.us/guide/bgnet/output/html/multipage/intro.html

So socket programming such as above is supposed to be done in Linux, but is possible in Windows. I've been trying to follow this guide but it's been a nightmare, and I'm considering dual-booting for my personal ease. Whats the best flavor of Linux? How is Gnome comparatively?
>>
>>52128081
is that bailey in the frame?
>>
>>52128001
Most people don't develop for the sake of developing, they develop because there are certain kinds of things they want to make. Many developers are mobile and/or web developers. Mac is great for this, firstly because it's the only OS you can do iOS development on, but also there are a lot of great web dev tools available for it. It can run pretty much everything Windows or Linux can run that a developer would want, except maybe visual studio. So why constrain yourself? If programming is your job, the price of a good mac isn't a big deal if it helps you do your work easier.
>>
>>52128103

Computers suck. The turing machine is where it's at.
>>
>>52128108
just use Cinnamon or MATE, Gnome 3 is AIDS
>>
>>52128065
not him, but he said
>they want to develop for iOS
can you really not understand those words?
>>
>>52128066
U(CS) \in U(S) = 1
(CS \not \in S)
|- CS \in S
>>
>>52128081
MOODS
>>
>>52128134
>they want to develop for iOS
I don't see how these words could be put together in a serious sentence
>>
>>52128098
Yeah, I don't recall it going against what I said. Maybe I'm retarded though.
>>
>>52128134
kek irl
>>
>>52128151
>being this much of a neckbeard
iOS is one of the most popular mobile platforms. iOS devices have a limited selection of devices which enables you to have tried and tested full compatibility for all relevant use cases. iOS users are generally more willing to pay for software than lagdroid poorfags. i'm not even iOS shill but seriously it's just another platform. you can even take an android app and reuse most of the code on iOS using roboVM.
>>
>>52128151
So just because your shit at programming doesn't making it impossible for others. IOS is a huge market, there is literally no reason a competent develop would be unable to write for that platform
>>
>>52128151
>I don't see how people could want a job!

Color me unsurprised.
>>
>>52128151
>I don't see how these words could be put together in a serious sentence
I'd get a CT scan if i were you
>>
>>52128220
>objective c
vomit
>>
>>52128001
>In all my experiences
Sounds like you are just too dumb to use what is widely regarded as a baby OS.

>If you use linux, everything you need is just there
This is subjective.
>>
>>52127898
I've been told that historically C never had support for a garbage collector as part of its design. That's why C-- was created - to create a gc'd C.
>>
>>52128272
you can use any language that compiles to java bytecode with robovm and you can freely (with very few restrictions) mix objective C with C/C++
>>
>>52128272
you can develop for iOS in almost anything these days
>>
>>52128248
Programming is in high demand. You can be buttfuck retarded and get a job, but to get one doing iOS programming? Yuck
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [Google]
1430853197680.png
331 KB, 474x432
>>52128327
ok
>>
>>52128151

iOS developers are in great demand.
>>
>>52128327
>but to get one doing iOS programming? Yuck
I'm personally an iOS and Android dev. I don't do it because i think the stacks are great, i do it because I'm passionate about making nice apps.

Also just about every well paying job is going to involve using some naff technologies, unless you are extremely good. I could earn much more as a web dev, but it's not an area that interests me as much.
>>
I was wondering why a function become 2x slower with optimizations ON, turns out Microsoft's memset() implementation in msvcrt.dll (the libc that's always available, used with winddk)
07FEFE0258E3h:
movnti qword ptr [rcx],rdx
movnti qword ptr [rcx+8],rdx
movnti qword ptr [rcx+10h],rdx
add rcx,40h
movnti qword ptr [rcx-28h],rdx
movnti qword ptr [rcx-20h],rdx
dec r9
movnti qword ptr [rcx-18h],rdx
movnti qword ptr [rcx-10h],rdx
movnti qword ptr [rcx-8],rdx
jne memset+148E3h (07FEFE0258E3h)

wtf? Write combing for something you almost surely are gonna use later?
A naive unoptimized C loop is:
~180000 cycles
that garbage:
~410000 cycles
>>
>>52127861
>&&&
>|||
Never used F# before, what the fuck??
>>
Shit man this is comfy.
#include <stdio.h>
#include <gc.h>
int main()
{
if(GC_malloc(sizeof(char)))
{
#define AO_DID_MALLOC_1
#line 7
}
char c = 'f';
if(GC_malloc(sizeof(char)))
{
#define AO_DID_MALLOC_2
#line 13
}
char input_buffer_char = 0x0;
if(GC_malloc(sizeof(unsigned int)))
{
#define AO_DID_MALLOC_3
#line 19
}
unsigned int i = 0x0;
scanf("%c",input_buffer_char);
i = (int)input_buffer_char;
if((char)i != (char)c)
{
printf("Please format your input properly and try again.\n");
}
#ifdef AO_DID_MALLOC_1
GC_free(sizeof(char));
#endif
#ifdef AO_DID_MALLOC_2
GC_free(sizeof(char));
#endif
#ifdef AO_DID_MALLOC_3
GC_free(sizeof(unsigned int));
#endif
#line 29
}
>>
>>52128408
the same as & and | in C#. & and | mean something else. I forget what
>>
>>52128327
>You can be buttfuck retarded and get a job

And yet, you haven't got one.
>>
Can you describe the syntax and semantics formally rather than a bunch of botched up examples that I don't care to try to figure out myself?
>>
>>52128456
I actually do. I'm only here because I didn't plan anything for my holiday
>>
>>52128294
Not built-in, but as a library why not?
>>
>>52128424
I really think you don't understand how the C preprocessor works.
>>
>>52128495

Fair enough, I'm just trying to shitpost.
>>
>>52128508
It's cool lad, I shitpost all the time
>>
File: 1450463515813.png (583 KB, 740x571) Image search: [Google]
1450463515813.png
583 KB, 740x571
>>52128424
>>
>>52128408
Bitwise operators.
&/| are mainly for match expressions
&&/|| are boolean
>>
>>52128495
It's pretty clear through your speech that you are either underage or retarded
>>
>>52126109
she has lupus.
>>
>>52128424
You do realize
#define AO_DID_MALLOC_1, etc are always defined?
Preprocessor is run first, then the code is compiled, your if statement does nothing.
>>
>>52128294
I've never heard that about C--. I thought C-- was just a sort of intermediate language before LLVM.

>>52127897
>code is a runtime modifiable tree
Sounds interesting to me.
The rest, meh.
>>
>>52128526
I'm a 22yo normie Tbh
>>
>>52128294
Well you can never have a fully correct GC in C because of unrestricted pointers, and any time you call into some code which was never built with that GC in mind all all hope is lost (including standard libc).
>>
>>52128500
A garbage collector requires:
1) a root set (list of base references)
2) a collection routine

This have to be part of the language syntax/semantics, almost impossible as a "library" for C. Maybe C++, but not C without it being really janky (and not worth it, pretty much the only reason you'll ever use C is because you don't want a garbage collector. I can't think of a good reason to use C+GC over any other language with a GC)
>>
>>52128689
>I can't think of a good reason to use C+GC

Triggering autismo-trons.
>>
It's made me think, though:
Since C and C++, pretty much every single language afterwards has been managed (without explict word not to be, e.g. unsafe{}).
Why is this?
>>
>>52128795
Communism
>>
File: tfw idle.gif (284 KB, 500x500) Image search: [Google]
tfw idle.gif
284 KB, 500x500
>>52128795
>C and C++ are now considered "unsafe" languages
>>
>>52128795
Because nobody is bigger than the userbase of the language they use
>>
>>52128823
they have always been unsafe
>>
>>52128823
#include <iostream>
int main () {
int* foo = new int[3];
delete[] foo;
std::cout << foo[0] << std::endl;
return 0;
}


Would you call this "safe"?
>>
>>52128795
To artificially slow down programs and to shill faster/newer processors (MOAR CORES)

|
|>
|3
|
>>
>>52128841
If you wanted to win over C/C++ users, wouldn't you want to do so with an unsafe language?
Or maybe... people don't like manual memory management... and people like garbage collectors... and /g/ autists are wrong...
>>
>>52128823
Heartbleed bug anyone?
>>
>>52128850
simple fucking memory management
>i want this memory
>ok im done with it now go ahead and delete it
>hey that memory I talked about? Print it

but they literally had to define an entire language like java and C# because people were just too fucking stupid to comprehend that once something is destroyed it is fucking gone so pointing to the place where it once was expecting it to be there doesnt make sense
>>
>>52128863
You realise you can have a language with both manual memory management AND garbage collection, not just as a switch but AT THE SAME TIME?
>>
>>52128875
Fucking idiot who has never worked with pointers, you won't always know whether the thing you're pointing to has been deleted or not
>>
>>52128875
What's the largest program you've ever written?

Recently made a programming language, had to implement algorithm-J type inference, it requires "type variables" to appear multiple times throughout type signatures, and for them to be "assignable" so that they'll all simultaneously convert to the new type.
Super easy memory management, right?

>>52128881
It's certainly possible but the recent trends have shown that language designers don't want to create it.
>>
>>52128850
>what is std::unique_ptr
if you're going to be picky about manual memory management at least bully C instead
>>
What are some cool things I can do with the json of a certain website? Maybe even 4chan's
>>
>>52128905
>It's certainly possible but the recent trends have shown that language designers don't want to create it.
What is D?
>>
>>52128928
... read it
and that's it
>>
Which open sores license is objectively the best?
>>
>>52128926
Was just showing that C++ is "unsafe". It's possible to be safe and not do stupid shit but Bjarne won't stop you from shooting yourself in the foot.

>>52128941
One language out of many. Who uses D anyways? (maximum kek achieved)
>>
>>52128875
>thinks literally every language besides C was invented because people are too stupid to understand how great C is
fucking ctards.
>>
>>52128905
>algorithm-J type inference, it requires "type variables" to appear multiple times throughout type signatures, and for them to be "assignable" so that they'll all simultaneously convert to the new type.
>Super easy memory management, right?
Yes, what's the problem?
>>
>>52128941
https://msdn.microsoft.com/en-us/library/ee340434.aspx
>>
>>52127897
Its just javascript without any useful syntax, everything is built by scratch using prototype OO
>>
>>52128944
MIT
>>
btw manual memory in D is really shit
>>
>>52128944
>>52128972
ISC
>>
>>52128881
It's a shame no one designs their language around memory arenas (nested, hierarchical, stacked, etc) with convenient syntactic sugar.
I find them to be the perfect sweet spot of fine grained control and "allocate and forget" type management (and it's often what I use and implement in C, but with somewhat verbose syntax).
>>
>>52128984
You just use malloc and free you retard
>>
>>52128943
course, but what kinda shit can I create that uses that information?
>>
>>52128960
Shared objects that have to keep track of eachother. Pretty trivially implemented using reference-counted pointers and weak references, but it's certainly not as trivial as >>52128875 makes it all sound.

Even if manual memory management "isn't that bad", when you DO accidentally memory leak / use-after-free, it can become hellish to debug and impossible to spot.
>>
>>52128944
>>52128972
>>52128999
WTFPL
>>
>>52129009
... a 4chan thread viewer

>>52129006
Write two functions, one that manually allocates any class and one that deallocates any class

you can't
>>
>>52128949
>Was just showing that C++ is "unsafe". It's possible to be safe and not do stupid shit but Bjarne won't stop you from shooting yourself in the foot.
But that can be said even for safe languages, you can, for instance, crash the Python interpreter just as easily as you can crash a C++ program.

>>52128949
>One language out of many. Who uses D anyways?
A lot of people actually and one of the major contributors works at Facebook and announced a while back that they actually use an internal tool written in D.
>>
>>52128944
bsd
>>
>>52129060
>... a 4chan thread viewer
absolute madman
>>
>>52128984
>btw manual memory in D is really shit
btw manual memory management in C++ is really shit, anyone who willfully chooses C++ for any large scale project is either an idiot or someone who invested too much time in their career becoming an 'expert' in C++
>>
>>52129060
>one that manually allocates any class and one that deallocates any class
malloc and free?
Maybe calloc if you want zero initialised or some shit.
>>
>>52129068
>you can, for instance, crash the Python interpreter just as easily as you can crash a C++ program.
I wouldn't say "just as easily."
I've never had a segfault in python code (I'm sure it's possible), yet I've had tons in C++. Specifically, I was having problems where I kept accidentally creating indirect infinite recursion. gdb was helpful, but "error in function Unify(...): call stack exceeded" (what Python would've told me) would have been a lot more helpful than sifting through template instantiations after a fat "Segmentation Fault"
>>
>>52129205
Yes but I was objecting the point that no language safety can save you from shooting yourself in the foot rather than one's lack of understanding a language they write in.
>>
>>52129110
C++ is a million times better for manual memory than D

>>52129161
constructor & destructor
which you cant call
>>
>>52129060
Object oriented programming is shit

Why would I allocate memory for a class? I think you meant object btw.
>>
>>52129227
You said 'allocate', which malloc/free does.
Stop moving the goal posts.
>>
>>52128972
Why?
>>
>>52128972
This

Or 2-clause BSD
>>
>>52128944
GPL is the only license that cares about your freedoms desu senpai
>>
>>52129238
Allocates a class... which means the constructor/destructor should be called.
How is that moving the goalposts?
>>
>>52129284
>which means the constructor/destructor should be called.
When the fuck was that a requirement?
Stop making shit up, you stupid fag.
>>
>>52129284
>"hey, allocate a class in C okay?"
>C doesn't have 'classes'
>"haha I win!"
>>
>>52129274
What about this one? >>52129054 It seems more truly free than GPL.
>>
>>52129297
Ok you complete stupid fuck so you're saying you can't do manual memory allocation for classes in D but that's completely fine because you can at least make storage space for them that you can't safetly use

>>52129300
D isn't C, and C++ isn't C
>>
where do you put the license, guys
>>
>>52129241
MIT licence is: "do whatever the fuck you like"
>>
So what's the equivalent of the F# pipe operator in Haskell? . ?
>>
>>52129393
there is none. But you can make one easily.

I'm not a haskell guy, but i think "." is function composition in haskell. the equivalent of << in F#.
>>
>>52129405
I don't know F# at all, but I see you guys raving about |> all the time. What does it actually do?
>>
>>52129419
z |> f x y
=
f x y z

you can do pipelines like

x |> f1 |> f2 |> f3 |> f4
>>
>>52129419
take the value of the expression before |> and passes it to be the last parameter for the function after |>. Makes code really readable and clear. Take fizzbuzz for example:

[1 .. 100]
|> Seq.map (fun i ->
match i % 3, i % 5 with
| 0, 0 -> "FizzBuzz"
| 0, _ -> "Fizz"
| _, 0 -> "Buzz"
| _, _ -> string i)
|> Seq.iter (printf "%s")



so this code is easily readable as:
make a list containing number 1 to 100
map it to a list of fizzbuzz strings
print each of those string

it makes it nice and logical. And i didn't need to create any variables or mutation of any kind to make the steps read from top to bottom like i often need to in other languages. It generally helps you avoid nesting loads a function calls inside each other.
>>
>>52129304
Legalizing murder isn't increasing freedom
Thread replies: 255
Thread images: 24

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.