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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 318
Thread images: 31

File: 1467387907257.png (1MB, 1000x1400px) Image search: [Google]
1467387907257.png
1MB, 1000x1400px
Old thread: >>57134410
>>
>>57138224
I'm currently dogfooding a SOM-Package to learn for my ML course. I'm considering writing one in ada just for shits & giggles.
>>
>>57138224
ty for posting my qt gf
>>
>>57138224
what a qt
>>
File: 2d54e7f737e0e30b71de77e7866ec9e9.jpg (177KB, 1345x750px) Image search: [Google]
2d54e7f737e0e30b71de77e7866ec9e9.jpg
177KB, 1345x750px
why the fuck does every junior developer role want 1-2 years experience?

don't they know what "junior" means?
>>
>>57138181
What's the point of life if you're not free? And by free, I mean true freedom. Not being a brainwashed consumer thinking Google search results are actually neutral.

>>57138120
Wikipedia code base is in PHP/MYSQL as well and to be honest from a developer point of view being able to handle only 50 000 requests /s with 200 servers is just pathetic. (Source: https://meta.wikimedia.org/wiki/Wikimedia_servers)

As for 4chan, using webp for every images could reduce all bandwidth for at least 30%. Also, if this leak (https://gist.github.com/dvliman/11264471) is real, the servers are basically wasted at this point.

Despite everything, 4chan and Wikipedia are both the best website on the internet though

>>57138224
Thanks for using an anime image
>>
>>57138289

Apply anyways. Call any side projects you've had experience.
>>
Does anyone use fonts with ligatures for programming?

Like this: https://github.com/tonsky/FiraCode

I'm heavily considering implementing support for that in my terminal emulator, since apparently the only one that supports it is Konsole.
>>
>>57138065
disgusting freaks of nature
>>
>>57138289
Maybe you should get some work experience, before you try getting some work experience

t. employer
>>
>>57138289
Employers market, they can afford to be picky.
And if you're not a good pick, they have 50 other interviewers that day that might be a good hire.

The "programmer shortage" was a lie invented by colleges to flood the software industry with low quality "coders" and effectively turn SE into the janitorial work of the 21st century.
>>
>>57138324
>rogrammer shortag
You mean, OO
>>
>>57138308
Why would they bother? They can see my resume. Unless you mean write my side projects as jobs, in which case I should probably also stop saying I'm a recent graduate looking for entry-level employment in my resume
>>
>>57138362
>not working during college
We're sorry, you lack the required passion for this position and as such, you are not a good cultural fit for this company.
Don't call us, we won't call you either.
>>
>>57138362

Experience does not just mean jobs, Anon. Write them as side projects, but put them on your resume regardless. Emphasize side projects as your experience.
>>
>>57138400
I had to change it to show they were projects today because people kept contacting me about senior-level jobs
>>
>>57138289
Get good... It seriously feels great to be on top.
>>
>>57138289
>>57138289
>>57138289
>>57138289
>>57138289
>>
File: 149439843084903.png (175KB, 694x585px) Image search: [Google]
149439843084903.png
175KB, 694x585px
>>57138434
I'm sorry Anon.
>>
File: Capture.png (12KB, 542x263px) Image search: [Google]
Capture.png
12KB, 542x263px
>>57138224
how do i do this?
>>
>>57138470
>No nothing
>>
>>57138492
>Not matching line separators
Find a new class.

Also, just do what it tells you to do
>>
>>57138492
it literally tells you specifically how to implement it
>>
Simple way to display a splash screen in java.
inb4
>java
>simple
>>
File: 1476612873492.jpg (108KB, 770x1038px) Image search: [Google]
1476612873492.jpg
108KB, 770x1038px
>>57138250
She has a dick actually
>>
>>57138544
First link on Google.
https://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html
>>
File: boy-or-boygirl.png (147KB, 798x597px) Image search: [Google]
boy-or-boygirl.png
147KB, 798x597px
>>57138569
>>
>>57138569
b--but ... that's even better actually :)
>>
>>57138576
yeah but its all cancerous shit. i tried for an hour. i was asking if anyone could simplify it for a retard
>>
File: 1374574508775.jpg (29KB, 499x500px) Image search: [Google]
1374574508775.jpg
29KB, 499x500px
>>57138224
>>57138569
>>57138580
>Draw a girl
>Call it a boy
Kill yourself, you degenerate.
>>
>>57138569
chuu~:3
>>
Right now I am living in Germany, speak English and German. I have learned C, the Linux and Windows API, a bit of C++, a bit of x86 assembly, a bit of C# and a tiny bit of Java.

The last two years I have spent programming my own framework in C that is supposed to solve some of the more retarded bullshit that Linux and Windows incorporate. That includes my own memory interface that works without userspace locks, an ISO9660 loader, an HTTP stack, a generic array structure, an INI parser and a 4chan API module as well as a kernel thread abstraction layer (no user threads as I fail to see the point in those) and a SOCKS connector. Right now I am also working on a way to access timezone information on both Windows and Linux.

The problem is: I have no mathematical background. I don't care for maths; it's outright boring to me, I tried to learn it and failed.

I don't even dare applying for jobs because I think the interviewers are going to tell me outright that I don't have what it's gonna take for me to work for them. Also I prefer to program slowly, but properly - in other words, I am not really productive.

If you would see this CV, would any of you consider hiring me? Should I generally develop more confidence?
>>
>>57138587
>all cancerous shit
Sorry but this is Java. You can still delete you "reusable" program and start over in C though (._. )
>>
>>57138621
In all seriousness no memes, I'm not that deep into learning java. Should i just switch to C?
>>
>>57138595
Based biased brainwashed thinking. There are no norms, no "true" way of life. This circlejerk need to end.
>>
>>57138618
>using INI

Don't think so buddy.
>>
>>57138618
I learned German for 1.5 years and "deutsche sprache, schwere sprache." I'd recommend becoming a little more comfortable but you should never stay in your comfort zone for too long.

Also, your English is amazing, even though you being a German will say it is not ;).
>>
>>57138631
To be honest when someone say Java or PHP I laugh nonchalantly.
C is a great language, I don't like C++ but it's useful. Python is most likely what you should learn.
>>
>>57138224
anyone got any one night python project ideas for a beginner?
>>
>>57138682
What can I do with Python? What makes it better than everything else?
>>
>>57138669
INI is still the most easy way to set up configuration files. There is a reason why UNIX/Linux still uses a plethora of them.

>>57138674
What exactly do you mean with "comfortable"? I simple don't have the confidence, because everywhere I go people talk about their skills, which just makes me feel insecure.
>>
>>57138311
>Like this: https://github.com/tonsky/FiraCode
I like ligatures and proper font rendering for reading as much as the next guy, but I'm not sure they're suited to a programming font.
>>
is programming hard?
>>
>>57138698
>I simple don't have the confidence

yeah i meant build confidence.
>>
>>57138707
no just takes time
>>
>>57138618
> I don't care for maths; it's outright boring to me
I didn't read that.

You should try to get hired by Google, it would be easier than applying for some retarded monkey base actually
>>
>>57138691
It's easy to learn so 'tards and normies use it everywhere for everything thus creating a market for it.
>>
>>57138708
And how am I supposed to do that? As I said I am lacking confidence to even try to apply for a programming job because they all seem to be so high level that I'd just make a fool out of myself there. As I said, I have no math background, I don't like it at all.

When I am lacking that initial confidence, how am I supposed to stand against all those graduates who are supposed to have learned that stuff for several years?
>>
>>57138755
Gotchya. Thanks for the serious advice friend.
>>
File: jtrac-callstack1.png (93KB, 739x710px) Image search: [Google]
jtrac-callstack1.png
93KB, 739x710px
>>57138691
Don't learn python, use it. Maybe Go or Rust would be more appropriate but Java is a joke at this point
>>
>>57138759
Most programming doesn't really require much in the way of math, and most graduates don't know jack shit anyway, haven't you see all those CS graduate memes?
>>
>>57138739
What do you mean by that, "I didn't read that"?
I assure you, higher maths are just not my thing. The last thing I took from school was algebra, and that's that. Make fun of me if you like, but it's the truth.
>>
File: 1454719052825.png (59KB, 442x768px) Image search: [Google]
1454719052825.png
59KB, 442x768px
>>57138765
>>
>>57138759
Tbh i have no idea what to do. I'm the java retard and I've been producing music for 4 years so that's my knowledge.

>>57138767
>someone tells me not to
>someone tells me to,

b-but minecraft was coded in java.
help
>>
>>57138759
Education is for retards unable to think by themselves. What's the problem?
>>
hey /dpt/, i need a project to work on for the job hunt. any ideas?
>>
I'm kind of lost on where to go. I've been using Python for a couple years and written some medium sized projects but they're nothing amazing and my utilization of OOP is shit. Stuff I've written and then looked up on Github is implemented so much better than my projects.

It's also not my job and sometimes it's hard to keep working on projects. I feel like a job environment could be really conducive to speeding up my learning but I'm a NEET and the thought of getting an office job makes me panic.
>>
>>57138778
>inb4 implying that memes are supposed to be talking seriously

Because I am so low-confidence that I am not taking them seriously. Doesn't matter which forums I frequent people just seem to be way smarter and more competent than I am.
>>
>>57138801
Minimalistic kernel with high performance IO
>>
>>57138790
There's a bunch of people who'd tell you otherwise, and who are actually quite successful with their education.
>>
>>57138789
Minecraft is also buggy and inefficient with a slow development cycle.
>>
>>57138822
And despite this, it still generates lots of money.
>>
>>57138822
>Minecraft is also buggy and inefficient with a slow development cycle.

while i was mostly joking, i've heard that notch isn't the best programmer either.
>>
>>57138815
I was thinking something higher-level
>>
>>57138831
Doesn't mean Java was a good language to program it in.

>>57138832
Well, obviously not, he chose Java.
>>
>>57138804
Coding is an art, not a science. Also, OOP doesn't match how algorithms work and therefor is always badly implemented. Design patterns try to fix this but it's like icing a shitcake.
>>
>>57138845
Alright so I guess i'll drop java and just learn C. but then I'll get a reply telling me i'm a fucking retard. not that I take anons' advice to heart.
>>
>>57138820
>successful
Many peeple gibe me monea, I'm must be useful yey! (/^.^)/
>>
>common lisp
>a sybol can be used to name many variables, but only one can be global

what the hell does these mean
>>
>>57138618
Does anyone else have anything to add here? Don't hold back, just tell me the truth.
>>
>>57138866
Symbols can be used for definitions and variable binding. You can only have one definition per symbol but bindings can shadow definitions and other bindings.
>>
>>57138888
>>
>>57138864
Well, it kinda is, isn't it?
>>
>>57138739

>Applying to Google

http://www.gwan.com/blog/20160405.html
>>
File: Three blokes faff about.jpg (77KB, 600x450px) Image search: [Google]
Three blokes faff about.jpg
77KB, 600x450px
>>57138289
>>57138362
It's standard bullshit HR people put up.
I know of a local web dev who put up 5+ year experience of stuff like Gulp and Angular yet hire anyone who knows of CSS and has even glanced at javascript.
As long as you have projects you've done outside of college you're fairly well off and can get a job at the majority of places..

If you want to work for Microsoft/Facebook/Google/whatever then get Cracking the Code Interview and treat doing every algorithm excercise in it like a job until you can do them on a whiteboard in sub-10 minutes without any problem. (they use it for weeding like others do fizzbuzz)

>>57138324
It's only really an employer's market in places like Silicon Valley or Seattle. In the vast majority of places they hire anyone with any coding experience whatsoever and basic communication skills. If you get fired you're going to have a job in less than two weeks afterwards as well.
They HR people adopt the same phrases into their descriptions as the tech hubs but it's perfectly fine to treat it like the most basic of guidelines. ("Oh, they want 5+ years of C++ experience? Well my 1 year of intensive C should do fine, it'll compile.")

>>57138618
>If you would see this CV, would any of you consider hiring me?
Pretty much any place would. That's really damn impressive.
> because I think the interviewers are going to tell me outright that I don't have what it's gonna take for me to work for them.
If so it won't have anything to do with your programming skills and it'll come in the mail afterwards as "Thank you for participating the position has ben fillled." rather than something embarrasing. Any programming job will have a shitton of people applying who can barely program or have a much less impressive and smaller portfolio than yours.
>Should I generally develop more confidence?
Yes, definitely. Your math worries are pretty much unfounded. Only like Quant finance-people are required to have a moderately strong math background.
>>
>>57138891
Capitalism is the worst kind of rating. If a more accurate rating system like Elo was used I wouldn't have this opinion.
>>
>>57138871
can you put it in words a retard would understand?
>>
File: cute anime pic 0072.jpg (36KB, 390x390px) Image search: [Google]
cute anime pic 0072.jpg
36KB, 390x390px
>deadalnix ragequitting D
heheheh
>>
>>57138912
inheritance was a mistake
>>
>>57138897
What... b--but... I thought Google was smart...
>C++
Oh.. Right.
>>
>>57138759
>how am I supposed to stand against all those graduates who are supposed to have learned that stuff for several years?
I am a graduate in like four months. My portfolio is thin, the most important thing i've picked up from my Bachelors is basic algorithm design that anyone could get from books and i've already forgotten 70% of the math i've been forced my way through. Despite that i'm better than the average CS student and have no real worries about getting hired.
TLDR: You've got nothing to worry about.
>>
>>57138903
Stop lying.
>>
>>57138931
The only easier way to put it would be to spoonfeed you the definitions of words you don't understand.
>>
>>57138903
>Pretty much any place would. That's really damn impressive.
Why do you think it's impressive? All I ever did was reading documents and implementing stuff right away, then after a while realizing what I did wrong and fixed that.

>Yes, definitely. Your math worries are pretty much unfounded.
As I said before, in forums in which more successful people post I always feel as if I am the retard because I just don't understand higher math, and they make it pretty clear that higher math is required universally. Also, don't forget that I am living in Germany, so software requirements may be different from the ones in the states.
>>
File: programming-challenges.png (302KB, 1920x1080px) Image search: [Google]
programming-challenges.png
302KB, 1920x1080px
Can someone post an updated version of this?
>>
>>57138976
No.
>>
>>57138962
nno lemme try
>>57138931
The same name can be used everywhere as long as it's not outside the scope of functions.

>inb4 that's not accurate
I don't do lisp
>>
>>57138976
00.Botnet
01.Botnet
02.Botnet
03.Botnet
...
>>
>>57138952

>My portfolio is thin
How thin?
>>
>>57138324
this.
>>
>>57138976
define ramming
>>
File: Gamecenter CX - Wah.png (298KB, 720x540px) Image search: [Google]
Gamecenter CX - Wah.png
298KB, 720x540px
>>57138964
>Why do you think it's impressive?
First that your portfolio exists at all. You have no idea how much worse a lot of applicants are.
Secondly that it shows a relatively deep understanding of memory, the Linux and Windows APIs and intermediate networking.
>As I said before, in forums in which more successful people post
In other words very experienced people who've been in the business a longass time and are discussing positions way above you or far more likely people who lie on the internet.
>and they make it pretty clear that higher math is required universally.
They're absolutely full of shit. Higher maths isn't required at all outside of very specific subsets of the industry such as quantitative analysts for high frequency trading. Even realtime system graphics people will admit their jobs don't require a significant amount of math.
It sounds like you've been listening to academics and not people who actually write code for a living.
>Also, don't forget that I am living in Germany, so software requirements may be different from the ones in the states.
Germany's software requirements aren't significantly different from the rest of Europe, I merely used American places of reference because that's where the HR people are getting the retarded idea of putting up higher and higher reqs for junior positions even when a fresh-off-the-boat patterns-pajeet or Javascript-jobber would get the job.
>>
what's wrong with rust
>>
>>57139112

Not much. It's just new is all. Also, the ownership semantics can be difficult to grasp.
>>
>>57139040
Think like 2-3 /g/ chart-rolled shitty programs and one small-to-medium-size school project android framework (which is maybe 4-5 weeks of code at the most) that can reasonably be put into a portfolio.
>>
>>57138964
Math isn't at all important. Problem-solving is.
Watch this: https://www.youtube.com/watch?v=O7wFP1Z5KQY
>>
daily tip: coding isn't the same as programming
>>
*maths
>>
>>57138976
doing all on this list will make haskell useful?
>>
File: shit font tbh.png (573KB, 587x551px) Image search: [Google]
shit font tbh.png
573KB, 587x551px
>>57139209
it will make it the most useful
>>
>>57139201
True, anyone can 'program.' Like your vcr, easy as pi. Only the elite know how to code.
>>
>>57139238
BAIT
AITA
ITAR
TARD
>>
>>57139253
>AITA
>ITAR
what did he mean by this?
>>
>>57139083
>>57139156
Well, it does not make me feel better about it, but at least I can now see that math might not be as required as it is always claimed to be. Thanks, guys.
>>
>caaaaadddaaddaaar
>>
are the low lvl language fags just a vocal minority here? or we electrical engineers?
>>
>>57139253
>>57139272
I give 2 BTC to the one who finds two words that can merge like that properly.
>>
>>57139295
C is on the upswing a bit recently with more people realizing that C++ OOP is retarded busywork and that you can write C-style code in C++.
>>
File: comfy.png (167KB, 376x328px) Image search: [Google]
comfy.png
167KB, 376x328px
DAILY PROGRAMMING CHALLENGE!

Create a function that prints tornado text like the following!
COMFY
OMFYC
MFYCO
FYCOM
YCOMF
COMFY
>>
>>57139308
CAT
ADA
TAD
>>
>>57139323
define CDD
>>
>>57139326
That's not how it works, it's never worked that way.
>>
>>57139314
#include <iostream>
#include <string>
int main() {
std::string text = "comfy";
for (size_t i = 0; i < text.size(); ++i) {
for (size_t j = 0; j < text.size(); ++j) {
std::cout << text[(i+j)%text.size()];
}
std::cout << std::endl;
}
}
>>
>>57139365
Erase the code and start over in O(1) like a true programmer.
>>
>>57139314
#include <stdio.h>
#include <string.h>

#define strlen_constant(string) (((sizeof(string) / sizeof((string)[0])) - 1))

int main(void)
{
static char text[] = "COMFY";
char first;
size_t i;
size_t text_length = strlen_constant(text);

for(i = 0;i < text_length + 1;i++)
{
printf("%s\n",text);
first = text[0];
memcpy(text,text + 1,text_length - 1);
text[text_length - 1] = first;
}
return 0;
}
>>
>>57139377
>producing O(n^2) characters of output in O(1) time
D:
>>
>>57139112
The Syntax is basically the worst of C++ but even more retarded.
I honestly can't fathom the mind that decided "Let's fix C++!" and then started out by ensuring that double-colons are everywhere in the code.
>>
>>57139410
This.
>>
>>57139410
Rust quickly turned into the monster it's trying to replace
>>
>>57139387
BTW, I am that German guy, and this is my code.

The "static" is not necessary. I first had a different approach that did not work, and the "static" is a leftover of that.

Well, that's the level I tend to code on.
>>
>>57139427
That's the level most people code on. Hence why Resharper is so popular.
>>
>>57139314
#define static_size(p) (sizeof(p) / sizeof(*p) - 1)
#define in(x) ,x
#define each(x) x_each(x)
#define x_each(i, lmt) (i = 0; i < (lmt); i++)
#define S "COMFY"
int main(void)
{
char *str = S S;
unsigned i, j;
for each (i in (static_size(str) - 1))
{
for each (j in (static_size(str) - 2))
putchar(str[i + j]);
putchar('\n');
}
}
>>
>>57139387
but anon.. memcpy is not O(1).
Sorry, try again.
>>
>>57139445
Is this good or bad?

Now redid the code a bit:

#include <stdio.h>
#include <string.h>

#define strlen_constant(string) (((sizeof(string) / sizeof((string)[0])) - 1))

int main(void)
{
static char text[] = "COMFY";
size_t i;
size_t text_length = strlen_constant(text);

for(i = 0;i < text_length + 1;i++)
printf("%.*s%.*s\n",(int)(text_length - i),text + i,(int)i,text);
return 0;
}
>>
>>57139465
god damn it, i'll just pastebin it
>>
>>57139450
your static_size function doesn't work the way you've written this
>>
>>57138860
Pretty much whats the point of learning c when you want to do oop
>>
>>57139481
gcc -E spits out
int main(void)
{
char *str = "COMFY" "COMFY";
unsigned i, j;
for (i = 0; i < ((sizeof(str) / sizeof(*str) - 1) - 1); i++)
{
for (j = 0; j < ((sizeof(str) / sizeof(*str) - 1) - 2); j++)
putchar(str[i + j]);
putchar('\n');
}
}
>>
>>57139471
It's fine.
You should stop being so self-conscious desu senpai.
>>
>>57139308
http://pastebin.com/raw/Dentkt9G
>>
>>57139493
>sizeof(char*)/sizeof(char)
>finding the length of the string
>2011 + 15
>>
>>57139468
Well, I already tried again: >>57139471
Although I should have declared text as const this time ...

>>57139496
I can't. I told you I had low confidence.
>>
>>57139493
Your problem is that you are using sizeof on a pointer, not an array. Array-to-pointer decay, you want to google that.
>>
>>57139526
it's size of the type of the array (char *) / sizeof the type dereferenced by arr[0], which is char
>>
>>57139533
What array? "str" is not an array, it's a pointer. An array knows its length, a pointer does not. A pointer has no concept of length. When you ask sizeof to query its length you'll get the size of the pointer - 4 byte on 32 bit processes and 8 byte on 64 bit processes.
>>
>>57139308
how many letters?

I N
N O

2 BTC please
>>
>>57139553
It's a stack array, it's fine.
You're allowed to do this for read-only stack arrays.
>>
File: apple programmers.jpg (19KB, 665x279px) Image search: [Google]
apple programmers.jpg
19KB, 665x279px
Why aren't you using the programming style of the people who are saving linux from irrelevance?

Do you want to be an unlikable suckless neckbeard forever?
>>
I havent programmed in like 5 months, where can i get some practice?
>>
>>57139567
I am though
>>
>>57139567
>if () ()
MOTHERFUCKER YOU DELETE THIS RIGHT NOW
>>
>>57138643
testosterone is packed way more in guys for a reason
>>
>>57139314

tornadoStep :: String -> String
tornadoStep [] = []
tornadoStep (x:xs) = xs ++ [x]

doNtimes :: (a -> a) -> Int -> (a -> a)
doNtimes f n = if n == 0 then id else f . (doNtimes f (n - 1))

tornado :: String -> [String]
tornado [] = [[]]
tornado xs = [ (doNtimes tornadoStep n) xs | n <- [0..((length xs) - 1)]]

flatten :: [[a]] -> [a]
flatten [] = []
flatten (x:xs) = x ++ (flatten xs)

showTornado :: String -> IO ()
showTornado = putStrLn . flatten . (map (++ "\n")) . tornado
>>
>>57139567
IMO all languages have conventions that are used more often in that given language, in that example I find it okay since it's C. And I wouldn't use braceless if statements in C#.
Another example: People in Ruby like to use 4 spaces in identation.
>>
>>57139561
No, it's not fine!

#include <stdio.h>

int main()
{
static const char array[] = "COMFY";
static const char*const ptr = array;

printf("%lu|%lu\n",sizeof(array),sizeof(ptr));
return 0;
}


Are you trolling or what?
>>
>>57139567

I don't like excluding braces. Yes, excess braces is horrid but I rather make it clear rather than have someone second guess the indentation is wrong and code is executed out of scope.
>>
>>57139314
with Ada.Text_IO; use Ada.Text_IO;

procedure Tornado is
Text : String := "SHILLING";
begin
for I in Text'First..Text'Last+1 loop
Put(Text(I..Text'Last));
Put_Line(Text(1..I-1));
end loop;

end Tornado;
>>
>>57139592
>doNtimes f n

iterate f !! n
>>
>>57139599
It compiles as -ansi -pedantic and runs fine.

Do you even know C?
>>
>>57139314
I really want to see a lisp solution
>>
>>57139596
>thinking that's ever okay

go directly to fail
do not pass init
do not collect garbage
>>
>>57139617
>-ansi -pedantic
Who cares if it compiles with that? It's still wrong. It only will not be wrong if by any chance the length of the data within the array is the same as the amount of bytes a pointer is reserved for.

Again, array-to-pointer decay. Google it. Nau!
>>
Am I doing that right?
#include <stdio.h>
#include <string.h>

#define comfy "COMFY"
#define comfiest comfy;comfy;
#define fuck(this) for(ever) {this;}
#define ever fag one = 0; one < bloat; comma
#define bloat dick_size
#define comma ++one
#define smaller(of) dick_size of one
#define fag autistic
#define autistic unsigned
#define size(dick) strlen(dick);
#define tiny dick_size
#define this printf("%.*s%.*s\n", smaller(-), &meh[one%dick_size], one, meh)
#define nice char* meh

int main(int argc, char** argv) {
nice = comfiest;
fag dick_size = size(comfy)
fuck(this)
}
>>
>>57139314
I am not good with computer
with Ada.Text_IO;

procedure Tornado_Text is
Text1, Text2 : String (1 .. 100);
Length : Positive;
begin
Ada.Text_IO.Get_Line (Text1, Length);
for I in 1 .. Length loop
for J in 1 .. Length - 1 loop
Text2 (J) := Text1 (J + 1);
end loop;
Text2 (Length) := Text1 (1);
Text1 := Text2;
Ada.Text_IO.Put_Line (Text1 (1 .. Length));
end loop;
end Tornado_Text;
>>
>>57139308
http://pastebin.com/ph1ctx44

~400 different examples
>>
>>57139682
define aaed
>>
>>57139669
ISO-C90 forbids mixing up declarations with code.
for loop initial declarations are only allowed in C99 or C11 mode.

Try again.
>>
>>57139679
You're thinking of strings like pointers, but in Ada they are simply arrays.
>>
>few C++ jobs
>hundreds of java jobs
I refuse to pajeet
>>
>>57139702
Then go for the C# jobs.
>>
>>57139686
not how it works
>>
>>57139693
Yeah I know but attributes and shit got me confused and I don't know how to make an array wrap anyway.

What is the correct way to do it?
>>
>>57139679
Easier way to Get_Line a string:
procedure TornadoText is
Text1: String := Ada.Text_IO.Get_Line;
-- ...
begin
-- ...
end Tornado_Text;
>>
>>57139735
>>57139602
>>
File: Am I a boy or a girl.jpg (52KB, 712x712px) Image search: [Google]
Am I a boy or a girl.jpg
52KB, 712x712px
bls help me

I finally created my first GUI! A calculator.

Now I need help to put some actual functionality into it.

I've gotten the variable 'sum' to display in the text but how do I make it so that the buttons work?

http://pastebin.com/7nPKTxEx
>>
>>57139735
>>57139602
and to add user inputted string, replace "SHILLING" with the call to Get_Line as seen in >>57139741
>>
>>57139687
Who said he's using C89/C90?
>>
File: 1475001629581.jpg (114KB, 970x880px) Image search: [Google]
1475001629581.jpg
114KB, 970x880px
>>57139679
>>57139741
ada kawaii desu ne?
>>
>>57139686
epic, didn't believe I would get the money but at least admit defeat homo
>>
>>57139757
If it does not compile for C89/C90, it's not C to me.
>>
>>57139741
Derp should have thought of that. But my retarded way of programming it I needed to know the length anyway. Is there a better way? Wikibooks said the size attribute for string is in bytes, not the length of the array... Although I guess I could convert that but seems like extra work.
>>
>>57139776
You're an idiot.
>>
>>57139760
>with Ada.Text_IO
>>
>>57139744
lol didn't even see that one before mine
>>
>>57139751


if (tits)
return answer;
else gtfo.();

>>
>>57139777
String'Length

BUT, you should use String'First .. String'Last instead of 1 .. String'Length. Ada Strings do not have to start at 1.
>>
>>57139778
You are retarded.
>>
File: 1457551465286.jpg (10KB, 280x200px) Image search: [Google]
1457551465286.jpg
10KB, 280x200px
>>57139789
TRIGGERED
>>
File: 1322945697431.jpg (123KB, 1680x1050px) Image search: [Google]
1322945697431.jpg
123KB, 1680x1050px
Hey /g/, beginner here, currently studying data structures. I was thinking about doing a program/project that creates simples shapes in an animation

But I'm scared of doing more like an animation project than a programming one.

What can be the "programming part" of a shape creator?
Randomize shapes, have some type of algorithm to create a shape, something of the sort?

I might as well ask for anyone willing to answer, is there an specific type of projects that employers look for and this might not be a good one to grab someone's attention?
>>
>>57139687
I definitely love C11

#include <stdio.h>
#include <string.h>
#define comfy "COMFY"
#define comfiest comfy;comfy;
#define fuck(this) for(ever) {this;}
#define ever fag one = 0; one < many; then
#define many dick_size
#define then ++one
#define smaller(of) dick_size of one
#define fag autistic
#define autistic int
#define size(dick) strlen(dick);
#define tiny dick_size
#define this printf("%.*s%.*s\n", smaller(-), &meh[one%dick_size], one, meh)
#define user char*
#define nice user meh
#define define
#define is main
#define random nice = comfiest; fag dick_size = size(comfy) fuck(this)
#define so fag a, user* b
#define Define fag is(so){random}

Define define
>>
>>57139812
Use Math operators like cos and sin to create orbits. JPL would love that shit
>>
>>57139776

You don't get to say what is and isn't C. We have a standards committee and standardization process because the language isn't headed nor is supposed to be headed by a benevolent dictator.

If you don't want to use the latest standard of C, that is YOUR choice, not the standard everyone follows.
>>
>>57139751
You could probably rewrite this whole thing as a simple for loop, since you have nearly identical values in every button.

Also, post shoes :3
>>
>>57139853
>If you don't want to use the latest standard of C, that is YOUR choice,
Actually, NO, because there simply might not be compilers available for the system. If I can't compile it on a C89/C90 compiler (which are the mostly available ones), then the code is just a piece of shit. The program is then coded in shit. Not in C, but in shit.
>>
>>57139793
Also, String'Range, if you're looping over first from last.
>>
>>57139883
Sorry, being scared of new things is pretty normal for normies.
>>
>>57139902
>completely missing the point
>>
>>57139835
10/10 shitpost kek'd heartily.
>>
>>57139793
(nor end at String'Length of course) an example:
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is
String1: String := "abc";
String2: String := String1(2 .. 3);
begin
Put_Line(Integer'Image(String1'First)); -- 1
Put_Line(Integer'Image(String2'First)); -- 2
end Test;

You can see when copying the String the indices stay the same (we copied indices 2 .. 3 so String2 has indices 2 .. 3)

>>57139892
and yes
for I in Text1'Range loop
is a simpler way of doing
for I in Text1'First .. Text1'Last loop
>>
>>57139883

That's the system and its ecosystem's problem, not the code's problem.

You know how long it took for Microsoft to even try and support C99? Near close to 14 years after it was published. Did anyone blame C99 for that? No, Microsoft was being a piece of shit and people simply either dealt with it or didn't.
>>
>>57139687

Right, but C11 is the current standard of the C programming language, so it is perfectly acceptable to mix declarations and code as much as one wants.
>>
>>57139926
Doesn't change the fact that such code is still useless.
>>
>>57139941
Of course - if you don't want it to be able to compile on Windows ...
>>
>>57139948
GCC and Clang both support Windows.
There is seriously no reason at all to use Microsoft's shitty compiler.
>>
>>57139948

Anon, I have been able to compile C11 on Windows for ages. What drugs have you been taking?
>>
>>57139925
Ada is so comfy, I really need to learn more and get better with it.

Glad it's seeing some popularity around here.
>>
>>57139948
Define Windows
>>
>>57139959
Windows <=> Visual Studio
Anything else is race defilement.
>>
>>57139957

>There is seriously no reason at all to use Microsoft's shitty compiler.
Especially considering Microsoft now has 1st party support for Clang in Visual Studio. There is literally zero excuse not to use C11 for everything.
>>
>>57139973
>Clang in Visual Studio
If you want to use crapware do it on your own crapware operating system.
>>
>>57139973
There is.

>_Generic( )
>>
>>57139943

Please do not use a subjective opinion and designate it as fact. Code is not "useless" based upon portability. Otherwise, you might as well say the software that flys airplanes or the software in your car might as well be useless.

You can have your own opinions on a langauge standard but don't conflate your opinions and present them as facts. It's disingenuous and harmful.
>>
>>57139988
>clang
>Linux
>more crapware than VS/Windows
Nice bait Anon but you should try to be more subtle.
>>
>>57139989
What do you fags have against _Generic?
It's just a somewhat obscure feature that you don't need to use.
>>
File: 1440455215568.jpg (326KB, 1600x1200px) Image search: [Google]
1440455215568.jpg
326KB, 1600x1200px
>>57139865
I wish i could have thought of that, but I'm on functionality now.

I guess I'm just gonna hammer in some events and then throw them on the stack like the dumb fuck CIA nigger that I am but in reality im just a vulnerable little girl.
>>
>>57140008
Exactly what a C++ developer would say.

>Just use what-ever you need pajeet
>>
>>57140020
_Generic is somewhat benign. It's just there to make the C99 "compiler magic" available to programmers.
_Generic is only something you might consider when writing an API.
>>
>>57139968
I typically use MSYS/MinGW-w64 exclusively, but if you're going the Visual Studio route, there is literally zero reason to not use Clang.

>>57139988
MSVC is crapware. Unlike MSVC, Clang supports the entirety of the C11 and C++14 standards, and has the ability to target many more instruction set architectures and OSs than just Intel/ARM + Windows

>>57139989
You do not need to use _Generic if you do not wish to, but it does make things easier in a number of cases.
>>
>>57140041
"compiler magic" is everything I'm trying to avoid while programming in C.
>>
File: 1384456790977.jpg (36KB, 545x475px) Image search: [Google]
1384456790977.jpg
36KB, 545x475px
How valuable/useful are Comp. Science post grads/masters?

Are they worth the hassle or should I be content with just undergrad?
>>
File: 1469759622784.png (537KB, 620x877px) Image search: [Google]
1469759622784.png
537KB, 620x877px
>>57138224
I wanted to ask something that I haven't found how to do in like 2 days, but since I'm gonna sleep soon guess I'll try tomorrow.
Good night /dpt/!
>>
>>57140076
If you ask, then no
>>
>>57140067
It's a simple type lookup. Nothing particularly spectacular.
Do you like thinking about the difference between cabsf and fabs?
>>
>>57140076
Do you want more potential to move up in your company? Get your masters.

Do you want to actually become master? Get a phd.

>>57140081
this

You'll either end up over educated and underexperienced or you'll actually learn something for the sake of learning.
>>
>>57139308
last one, this time from a bigger custon dictionary (http://app.aspell.net/create?max_size=95&spelling=US&spelling=GBs&spelling=GBz&spelling=CA&spelling=AU&max_variant=1&diacritic=strip&special=hacker&download=wordlist&encoding=utf-8&format=inline)

Includes diagonals too

Too big for pastebin


https://mega.nz/#!Q5Nl0S7K!pTUUkYgvyxFWuyEHTWtxLlpMFzT5fBLAqfoI0NWQXWs
>>
>>57140081
>>57140094

Well my bad maybe it was my tone, but I don't feel like doing it, at the same time, I feel like regretting not planning a post grad strategy while I'm still an undergrad...
>>
>>57140067

There's no real magic in it. It works more or less like a macro. It's just that it also happens to be aware of the type of its argument.
>>
>>57140099
the bottom line is that if you're working with corporations Apple, oracle, m$haft, you should get your masters.
>>
>>57140107

Well, I'd like to work for Microsoft. A master's plus a couple of small side projects should be sufficient?
>>
If I'm fluent in Japanese and I can program, what company should I look into and weigh that against other candidates?
>>
>>57140226
Sony
>>
>>57140226
amiami
>>
>>57140138
I'm a c# dev for them fuggers. Get your BS and apply for work with them. They will most likely play for your MS if you find a solid branch. Always be honing your skill.
>>
>>57140256
>honing your skill
*teleports behind you*
*outprograms you in japanese*
>>
>>57140247
They canceled my persona 5 pre-order when I asked them not to days before the deadline (I was moving)

Fuck them, I won't even be a codemonkey for them anymore
>>
>>57140265
なんだたおおお?まさか!
>>
File: 1443715362677.jpg (77KB, 480x446px) Image search: [Google]
1443715362677.jpg
77KB, 480x446px
>>57140265
its too late for this shiz

im off to bed
>>
>>57140267
I was thinking about importing this, how hard is the japanese?
>>
>>57140284
It's a story-driven RPG with lots of cultural references set in JAPAN written in JAPANESE, a language with lots of implicit nuance.

But sure, go ahead and stop playing after every word bubble because you want to "read" the text with your google translate app on your phone.

I'm sure it'll be the same.
>>
File: Screenshot (359).png (561KB, 800x600px) Image search: [Google]
Screenshot (359).png
561KB, 800x600px
>>57140284
If you can read this, you're golden.
>>
File: petting the awoo.png (1022KB, 1140x1200px) Image search: [Google]
petting the awoo.png
1022KB, 1140x1200px
Do people in non-english countries have their own words for programming terminology or do they just say it in english?
>>
File: 1466329334062.jpg (24KB, 258x263px) Image search: [Google]
1466329334062.jpg
24KB, 258x263px
>>57140337
>non-english countries
>>
>>57140337
Here we mostly use English terms but often with native grammar and sometimes even pronunciation.
>>
>>57140256

I'm already working on my MS. A good portion of my degree is getting paid for by the Office of Naval Research. I'm going to be dealing with some Windows Driver Kit stuff as part of my research project. I've also been playing around with .NET core on Linux in my spare time for funzies, although I haven't started any projects with it.
>>
>>57140138
>I'd like to work for Microsoft
why? everywhere except devdiv sucks and even that's nothing special
>A master's plus a couple of small side projects should be sufficient?
>master's
>sufficient
top kek. much more than sufficient. i've worked SDET contracts at Microsoft and i didn't even graduate high school (not that they asked). it was uncomfortable when people were impressed by basic shit. it was like they'd only ever used C# for writing unit tests and automations of a specific sort and didn't realize that it's a programming language and you can do literally fucking anything you want with it. i was basically a self-educated half-retarded kid when i was there and i was coming up with and doing shit my leads or other full-timers surely should have done long before. of course i had to learn how to break those things the right way or i'd get pushback because they didn't want to look bad for not doing it themselves/earlier. some fuckin culture they've got going there, great for the business i'm sure. anyway except in a couple specific places, most of the SDETs and even devs there are surprisingly bad. maybe i was naive but i expected better going in. the bar isn't that high is what i'm saying
>>
can someone please define "abstraction"

what does it mean
>>
>>57140337
We do everything in English.
It is not a hard language so it is just easier this way.
People also write papers in English. There is no point in denying that it is a global language at this point.
>>
>>57140399
it's an abstract kind of thing
>>
>>57140399
It's hidden complexity.
Imagine a black box that takes an input and spits out a result.

Inside the black box is a bunch of functions that perform work on the input, but the user doesn't need to worry about that, because the black box is self-contained.
>>
>>57140389

>why?
It's nearby, pays fair wages, is relatively stable, and is one of the few places around that where I might actually be able to do some form of programming that doesn't involve webshit.

>i've worked SDET contracts at Microsoft and i didn't even graduate high school (not that they asked).
Isn't SDET just testing?

Also, I've had classmates who have tried to get into internships at Microsoft, and apparently their interview questions can be rather tricky.
>>
>>57140454
>their interview questions can be rather tricky.
For instance?
>>
>>57140466
>Which is faster? while (1) or while (2)?
>>
>>57140473
Goto
>>
>>57140473
My answer is: a decent compiler will see that the expression is always true anyways, and thus will just insert a jump with no check.
>>
>>57140496
Wrong.

while (2) is faster than while (1).
>>
>>57140500
*On my machine :^)
>>
>>57140500
Bullshit.

>while(1)
>jmp 40050a <main+0x4>

>while(2)
>jmp 40050a <main+0x4>

And that's with -O0. With -O3 it's just
>nop WORD PTR cs:[rax+rax*1+0x0]
in both cases.
>>
>>57140500
this

i doubled the speed of my program just by wrapping it in while (2)
>>
>>57140553
while(-1) is superior. I learned it in deep secrets of C.
>>
>>57140527
>>57140512
>>57140496
That's not what it says on my answer sheet, anon.
>>
O(1) = O(0)

?
>>
>>57140564
I don't care. Your answer sheet was made by a retard who deserves to be beheaded with a rusty saw if it actually claims that compilers are not capable of recognizing constant expressions.
>>
>>57140473
>>57140500
Kek, Is this the Google senior engineer interview?
>>
>>57140466
I honestly can't remember. That was a conversation from over a year ago. I do recall that it was some sort of logic puzzle along the level of WTFness as Google's "you are shrunken to the size of a nickel and placed into a blender" problem.

>>57140473
Neither. Even if we are assuming no optimizations whatsoever, it takes the same amount of time to load the immediate 1 into a register as it does 2, on every instruction set architecture worth discussing. The rest is going to be a comparison to 0 and a conditional jump, regardless of the immediate. In optimized code, this is just an unconditional jump.
>>
File: Mental Illness.png (127KB, 1005x637px) Image search: [Google]
Mental Illness.png
127KB, 1005x637px
>>57140564
What runs faster
x = x + 1
Or
x++
>>
>>57140575

Actually, no. O(1) implies constant time, because there is always going to be some constant that you can multiply by 1 to get the actual amount of instructions used, O(0), however, implies no time expended whatsoever. An algorithm can only ever be in O(0) if it is never run.
>>
>>57140609
>implies
I'm gonna need some proof
>>
>>57140592
>>57140585
>>57140473
>>57140605
>>57140609

Actually, the correct answer is:
>Neither. Both of them do not terminate and therefore take infinite time.
>>
>>57140605
>x = x + 1
This takes no time at all as the compiler can immediately infer it is false for finite values of x
>>
File: imgui.png (10KB, 654x562px) Image search: [Google]
imgui.png
10KB, 654x562px
Name a GUI library better than ImGUI.
>You can't
>>
>>57140454
>one of the few places around that where I might actually be able to do some form of programming that doesn't involve webshit
ugh, yeah. this place is lousy with shitty web startups. stability is tricky. it's more about politics and getting along with the right people than it is being good at your job. so, knowing you, you'll wanna be *really* good at your job

>Isn't SDET just testing?
haha. i guess? development and maintenance of test automations and automation frameworks, internal tools and pipelines, environments, etc. if you call that just testing

>I've had classmates who have tried to get into internships at Microsoft, and apparently their interview questions can be rather tricky
depending on the department it can be harder to get an internship than an actual job, kek. internships are in higher demand
>>
>>57140629
We have never specified what is in the loop body. There might be a break in it.
>>
>>57140473
An abstract concept can't be faster than anything anon.
>>
>>57140657
an abstract car is faster than an abstract bike
>>
>>57140399
"Keep that icky programming stuff away from me".
or
"What colleges teach CS grads to prevent industry competition".
>>
>>57140663
You need to dream bigger darling
>>
>>57140592
Cracking the Code Interview has MS "interview" questions if I recall correctly.
>>
>>57140700
If it's a real question, I guarantee its a trick one to see if you're retarded.
>>
>>57140641
honestly that's about the level of performance that should be expected given what it's doing. where imgui really stands out is not looking like absolute dogshit out of the box. bravo for that
>>
>>57140720
Not looking like dogshit isn't really the greatest thing about it, it's that it's supremely simple to use compared to all the other shit out there and doesn't require massive blobs of files, drawcalls or state management to create a working GUI for your code.
>>
>>57140732
of course. there's nothing not to like about it, but an immediate mode design is naturally straightforward in that way, so i don't consider it unique to imgui. not looking like shit apparently is, however. and of course, extra points for being minimal, standalone, and backend-agnostic
>>
>>57139957
>GCC and Clang both support Windows. There is seriously no reason at all to use Microsoft's shitty compiler.
Sure there is. Visual Studio is the only decent working visual debugger available on Windows.

WinDbg is overall more powerful but it just has so many small super-annoying flaws that many opt for VS instead even if they never use the software for anything else.
>>
>>57140641
Yo, thanks for posting it, I asked you about the skinning capabilities the other day and decided to give ImGui a go yesterday, this shit rocks.
>>
Learning C as I write ffmpeg bindings. Rate my code:

#include "avio.h"
#include <errno.h>

AVFormatContext *format_context(AVFormatContext *ctx)
{
errno = 0;
int err = avformat_open_input(&ctx, NULL, NULL, NULL);
if (err < 0) {
errno = err;
return NULL;
}
err = avformat_find_stream_info(ctx, NULL);
if (err < 0) {
errno = err;
return NULL;
}

return ctx;
}

void destroy(AVFormatContext *ctx)
{
av_free(ctx->pb->buffer);
ctx->pb->buffer = NULL;
av_free(ctx->pb);
avformat_close_input(&ctx);
}

AVCodecContext *codec_context(AVFormatContext *ctx, const enum AVMediaType type)
{
errno = 0;
AVCodec *codec;
if (av_find_best_stream(ctx, type, -1, -1, &codec, 0) < 0) {
return NULL;
}

AVCodecContext *codecCtx = avcodec_alloc_context3(codec);
int err = avcodec_open2(codecCtx, codec, NULL);
if (err < 0) {
errno = err;
avcodec_free_context(&codecCtx);
return NULL;
}

return codecCtx;
}

char *codec_name(AVFormatContext *ctx, const enum AVMediaType type,
const bool detailed)
{
AVCodecContext *codecCtx = codec_context(ctx, type);
if (codecCtx == NULL) {
return NULL;
}

const AVCodec *codec = codecCtx->codec;
const char *src = detailed ? codec->long_name : codec->name;
char *ret = malloc(strlen(src));
strcpy(ret, src);
avcodec_free_context(&codecCtx);

return ret;
}
>>
>>57140644

>it's more about politics and getting along with the right people than it is being good at your job. so, knowing you, you'll wanna be *really* good at your job
Eh, I could fake normie if I needed to. That said, I want to take pride in my work, so I'm going to try and do my job as best I can.

>depending on the department it can be harder to get an internship than an actual job
Then why seek an internship at all?
>>
goodmorning dpt

i woke up a little late today
>>
>>57140926
Cred goes to whoever posted Handmade Hero on here a couple of months ago. I found out about ImgGUI on there.
Another one that might interest specifically C/C++ coders are https://4coder.handmade.network/ which does some nifty stuff like this: https://www.youtube.com/watch?v=11q7yC5-GKM
>>
>tfw you map a complex variant record to a 64-bit word using representation clauses
>and it just works
>and GNAT warns you about bad overlaps of different varints
>>
>>57141059
Well does it just work or not?
>>
>>57141097
It just works.
And in case you fuck up, you get proper warnings.
>>
>>57141104
Oh I get it. The wording confused me.
>>
>>57140926
errno is an artefact from hell. Just let your functions return error codes directly, and save your actual results in pointers - or, in your case, a pointer to a pointer.

Also be aware of your critical path:

int format_context(AVFormatContext*ctx)
{
int my_errno;

if(0 != (my_errno = avformat_open_input(&ctx,NULL,NULL,NULL)))
goto LABEL_ERROR;

if(0 != (my_errno = avformat_find_stream_info(ctx,NULL)))
goto LABEL_ERROR;

my_errno = 0;
LABEL_ERROR:
return my_errno;
}
>>
>>57141113
Yeah, sorry. The post was bad and I should feel bad.

>>57141126
Errno, varargs and unions are the bane of every binding writers existence.
>>
>>57141126
>>57141164
I use errno here >>57140953 because it integrates nicely with the binder language's(Go) error handling. Should I just declare a pointer on the Go side and have C allocate it?
>>
>>57141126
There is literally nothing wrong with errno.
>>
>>57141189
You want to read the man page for strftime.
>>
>>57141173
>Go
If errno maps well to Go, I see nothing wrong with it.
It's always been a royal pain in the ass for C#, Ada and Haskell which are the only languages I wrote bindings to C in.

I'm not sure about that allocation.
Who cleans that up?
Maybe you should hook it up to Go's GC.

>>57141189
In glibc it's not even a fucking variable.
It's a goddamn macro.
>>
>>57141209
>It's a goddamn macro.
What of it?
>>
>>57141209
It's a macro to a function call which accesses a variable that is stored on TLS. Which means that it's unique to each kernel thread.
>>
>>57141002
>I want to take pride in my work, so I'm going to try and do my job as best I can
i hear you. i'm the same way. i was never a huge fan of microsoft, generally, but i still took my work seriously while i was there. the amount of political bullshit was really disappointing, though. people will get paranoid about getting culled and they'll throw someone under the bus to cover their own ass. obviously not everybody is like that, i knew some really fucking cool people there. but to be sure, some pretty shitty people have worked their way into pretty safe positions by resorting to such tactics. but i guess that's probably the case with any company that size

>Then why seek an internship at all?
it looks good to employers. interning is just a proactive thing to do because it adds to your education and shows initiative and shit, but it shouldn't and doesn't mean that's the company you've already decided you want to work at for your career. most interns get the offer to come back full time, but certainly not all of them do. the ones that don't either didn't necessarily want to work there full time to begin with, or they decided they definitely didn't want to during the internship, kek
>>
>>57141209
Can't hook it into Go's GC, but manually deallocation is trivial with a defer statement. If passing a pointer is a better practice, I can easily switch to that.
>>
>>57141215
>>57141213
Sure, there are good reasons for it to be a macro.
But you cannot just link against errno from some other language. And that sucks.

Also it's just deceiving. If it is a function, it should look like a function, not like a global variable.
I know backwards comparability blabla.
But I just don't like it.
>>
>>57141251
That's why I say: always return error codes directly. Don't do bullshit like checking for a specific error value and THEN reading the fucking error code - instead return the error code directly.
>>
>>57141247
>trivial with a defer statement
That's not really the point though.
If using defer for something like that is idiomatic Go, then do it.
I have no Go experience, so I don't know.
But a good binding should feel like it was written in the target language.
>>
>>57141251
>>But you cannot just link against errno from some other language.
But you can.
>>
>>57141317
Tell me how I can link against a macro.
I could link against the __error function the macro expands to, sure.
But that's really not what I want.
It's not portable, because some other POSIX implementation might do something else.
>>
>>57141338
>It's not portable
It's not like the piece of shit language you're using is portable lmao.
>oh no, how dare other languages use features that my language doesn't even know exists
>>
>>57141367
Usually C works with everything. That's why it's still used everywhere - because it runs everywhere, and the interfaces usually are also well documented.
>>
>>57141338
And once you have errno what do you do with it?
>>
>>57141398
That depends on what you actually want to do.

Some function calls return an error code that is non-fatal - take recv() on non-blocking sockets for example. That function might return a EAGAIN if there is no data available on the socket, but the socket has not yet timeouted or has been closed. In such a case you rather want to call select/epoll to wait for data to be sent to the socket rather than just freeing all resources that you have reserved so far and just failing like a prick.
>>
>>57141444
>That function might return a EAGAIN if there is no data available on the socket
How would you know what it has returned?
>>
>>57141367
You can use any C feature you want inside your code, I don't care.
But you should design your library interfaces in ways that are easy to link and bind to.
That means no errno, no varargs and no unions in user facing prototypes.
Which is good C style anyways.
(You can have *additional* vararg variants of printf-style functions to make C programmers lives easier)

C is not the only language in the world.

>It's not like the piece of shit language you're using is portable lmao.
Now you are just shitposting.
I have that portability problem already when I want to run the same code on Linux and BSD.
And virtually any language can do that.

>>57141398
>And once you have errno what do you do with it?
I read it, duh.
But what I do next depends on the target language.

If the language has exceptions and exceptions are widely used, then I translate errno
into the appropriate exception type and throw that.
If exception are not available or not appropriate I return it as a normal return value or as an out parameter (again, depends on the specifics).
I just try my best to translate that errno mess into the target languages preferred way of error handling.
>>
>>57141457
>If the language has exceptions and exceptions are widely used, then I translate errno
>into the appropriate exception type and throw that.
How would you know which one is appropriate?
>>
>>57141448
Sorry, I phrased this incorrectly. recv() will not return an error code, but rather -1, and set errno to EAGAIN.

Don't get me wrong, I see the point why someone would like to read errno there.
>>
>>57141457
>C is not the only language in the world.
I sure hope all of your language's features are easily usable from all other languages. Otherwise you'd be a major hypocrite.
>>
>>57141476
You obviously don't get it. errno is a macro. EAGAIN is also a macro. If you can't access the one, then you can't access the other either.
>>
>>57141497
EAGAIN has a value that can easily be retrieved.
>>
A new policy at work is for all software requirements to go into an HP product called HP Application Lifecycle Management (ALM). The business analysts spend all their time typing up stuff in ALM. However, as part of our "least privileges" security policy, developers don't have access to ALM. Never underestimate the stupidity and incompetence of large organizations. They are literally hiring people to write documents that nobody will ever read. Then management sits around scratching their heads, wondering why developers don't know the requirements.
>>
>>57141512
The address of errno can easily be retrieved.
>>
>>57141514
Those are diversity jobs.
be thankful they're not stuffing token hires in your department.
>>
>>57141519
How? For EAGAIN I open the definition, or just use this:

http://www.virtsync.com/c-error-codes-include-errno

And there we have the code. Getting errno is a little harder because it's a thread-local variable.
>>
>>57141533
>How?
By opening the definition.
>And there we have the code.
Not portable.
>>
>>57141463
I define exception types for all values of errno that can occur plus a "catch all others" one.
It's a huge pain in the but.
No it's questionable whether something like EAGAIN should be an exception.
It really depends on the API in question and how the target language usually deals with errors.

>>57141480
For library code, that I expect to be used by other languages,
I export a easy to bind C compatible API.
If my language can't do that directly, then I have to write a C wrapper that does it.
Kinda like libzmq handles it.

>>57141497> EAGAIN is also a macro
You write a small C file that exports it's value a a linkable int.
>>
NEW THREAD!!

>>57141551
>>
>>57141543
OK.
>I dun care.
>>
>>57138691
don't fall for the "python is for normies" meme

if you dive into its depths you will learn its true power level

(cython, twisted, various godly libs and frameworks, outright spooky syntax magic)
>>
File: 1459535824992.jpg (94KB, 500x701px) Image search: [Google]
1459535824992.jpg
94KB, 500x701px
>>57141639
Agree. Gradual typing and metaclasses are cool.
>>
>>57140605
Surely innocence and awareness are opposites?
Thread posts: 318
Thread images: 31


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.