[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: 375
Thread images: 44

File: 1472705944027.jpg (428KB, 1455x771px) Image search: [Google]
1472705944027.jpg
428KB, 1455x771px
Previous thread: >>56637274

What are you working on, /g/?
>>
First for not programming
>>56644004
>>
Eclipse or NetBeans?
>>
>>56644047
eclipse for sure
>>
twats
>>
File: QxOe1dW.png (136KB, 2875x3298px) Image search: [Google]
QxOe1dW.png
136KB, 2875x3298px
Uploaded a new WinAPI project I worked on for a few weeks during the summer, on my github.

What do you guys think about my epic C function call skills? https://github.com/Gikoskos/KiNO_Win32/blob/master/k_win32gui_main.c#L294
>>
>>56644140
Disgusting.
>>
>>56644183
But it works perfectly anon. The whole app hasn't got a single memory leak or invalid memory access and it's super fast.
>>
>>56644204
But it makes me want to throw up looking at it.
>>
File: 1441684460338.jpg (92KB, 1280x720px) Image search: [Google]
1441684460338.jpg
92KB, 1280x720px
>>56644140
>>56644204
>WinAPI
>>
>>56644219
rlx anon i bet he is 10 languages hello world programmer and linux poser
>>
>>56644204
this >>56644246 was for you not for >>56644219
>>
File: Capture.png (19KB, 1166x156px) Image search: [Google]
Capture.png
19KB, 1166x156px
>some anon told me to use GLEW to do pic related
>I have no idea how
>>
>>56644140
not bad but you might wanna use another API, microsoft needs to get its shit together
>>
>>56644219
If I added comments it makes perfect sense to see why I did that. You can check the compiled binary on Releases to understand what really goes on.

>>56644222
In my 2011 computer, managed languages like C# or Java that run 100 layers above the OS are extremely slow. Small apps take like 1 minute just to open on Win 8.1, Intel i5 3.2Ghz, latest Java version.

Maybe I don't have enough RAM though for the memory hungry beast that is the JVM though.
>>
>>56644140
What happens if a localized string is longer than the small fixed-sized arrays you allocate for them? LoadStr does not seem to let you pass in a string length, so it'll happily overwrite your buffer, leading to all sorts of mayhem.
>>
>>56644310
It won't overwrite the buffer. You're right it might seem deceptive at first but LoadStr is just a macro and can only be used on arrays (not on pointers).

It's basically a convenience wrapper for LoadStringW of Winapi which takes as argument the size of the array:
https://github.com/Gikoskos/KiNO_Win32/blob/master/k_win32gui.h#L58

The buffer never overflows in case the localized string is longer. It just displays less characters.
>>
>>56644368
Fair enough. But for the sake of all that's sane and holy, don't call it "LoadStr". It's a macro, follow macro naming rules and rename it to "LOAD_STR" or "LOADSTR". You seem to have mixed CamelCaseMacros and some UPPERCASE_MACROS. Don't do that, be consistent when naming things.
>>
Am I understanding this right?

:(){ : | : & };:

This executes a function :(), and while it is executing it spawns children functions infinitely

so it's a fork bomb
>>
>>56644424
You're right, I didn't think of it. Might change it to make it more readable. Might as well add more comments. People might start thinking that my code is complicated while it's not

In previous commits you can see the same function, and what it looks like without using localized strings. It's much more simple.

But I'm quite proud of the localization system
https://github.com/Gikoskos/KiNO_Win32/blob/master/k_win32gui_locale.c

It was kinda tricky to implement it. It uses the satellite DLL technique that some other popular programs use like the AMD catalyst or Daemon tools
>>
>>56644004
What is the most axiomatic programming language? What I mean is, what programming language works on the least amount of abstract instructions? I'm not talking about something like brainfuck, I mean an abstract language.
>>
>>56644494
I meant that it was tricky because I wanted to have the runtime change language effect without having to reboot the program every time; like Skype or Notepad++ have.

Notepad++ uses XML files though, I'm using resource DLLs instead.

Can anyone tell me what that .po localization system is that I see on many linux app source codes? How does it work, what library it uses, etc?
>>
>>56644270
0. Set up GLFW
1. Generate GL loader with http://glad.dav1d.de/
2. Include in build
3. ???
if (!glfwInit()) {
exit(1);
}

GLFWwindow *window = glfwCreateWindow(800, 600, "GLFW + GLAD", NULL, NULL);

if (!window) {
glfwTerminate();
exit(1);
}

glfwMakeContextCurrent(window);
/* glfwSwapInterval(1); */

if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) {
glfwDestroyWindow(window);
glfwTerminate();
exit(1);
}

4. Ancient meme!
>>
>>56644457
:() opens the declaration of a function called :
The brackets {} contain the function body
the function body executes the : function and pipes the result to another : function
& means it's done in the background (essentially, new thread/process)
; closes the function definition
: immediately launches the function
>>
I was asked to do my first freelancing job as a programmer (C/C++). I've never worked before in this field and I'm still studying computer engineering. What do I charge? What are your experiences on the field?
>>
>>56644004
They all look like dorks but holy shit I'd cum in the third one from the left's boypucci
>>
>>56644004
Debugging code i wrote last night while drinking. and just generally unfucking it
>>
>>56645199

That's gay.
>>
File: SlidingPuzzle.jpg (188KB, 1249x865px) Image search: [Google]
SlidingPuzzle.jpg
188KB, 1249x865px
If anybody can guess what the marked function does I will literally give him 3 (You)'s
>>
File: frog-fs8.png (97KB, 1400x1400px) Image search: [Google]
frog-fs8.png
97KB, 1400x1400px
Do you guys have twitter? do you post programming related stuff?
>>
>>56644047
Netbeans if you're not a fedora tipper
>>
>>56645613
mouseClickInBoundsOfEmptyTile?
>>
can someone write a twitter bot for me which retweets popular content and sometimes flat out steals it?

Thanks in advance
>>
>>56645653
You need to specify a bit but I think youre close
>>
>>56645665
That's the best I can do.
>>
>>56645675
Just tell me what you mean by in bounds
>>
>>56645703
wow rude reported
>>
>>56645118
You are very lucky. I'd kill to have a freelancing job that's C/C++ and not webshit or databases.
>>
>>56645723
what kind of freelancing job do you do?
>>
>>56645738
Whatever I can get, so mostly web stuff now. But I could do science stuff or whatever in C++.
>>
>>56645753
what's your background?
>>
>>56644140
What's those string prints that can fail and are always checked for errors?
Have you considered using a macro to avoid having to write those failure cases like that?
>>
>>56630462
There's some ogl extension header generator somewhere which I'd recommend you use.
>>56645663
Do it yourself.
>>
>>56645763
I have a university degree in applied math.
>>
>>56645788
but how do you advertise yourself?
you got a website or something?
>>
>>56644204
>doesn't have a single invalid memory access or memory leak
Either of those can be considered fatal errors. If you normally get this then consider simplifying your use of the language.
>>
>>56645613
It checks if the click occurred in the empty tile.
>>
>>56645815
> how do you advertise yourself?
I don't advertise, there are websites where you can find such jobs.
>>
>>56645912
It actually kind of does the opposite
*Hint: A tile is 100*100 pixel
>>
>>56645613
What language is this that forces you to write private and public everywhere?
>>
>>56645974
Java
>>
>>56645974
yava
>>
>>56644004
The YMCA of modern era.
>>
File: 1406485757640.png (305KB, 640x974px) Image search: [Google]
1406485757640.png
305KB, 640x974px
Can you really learn programing with no computer and just SICP? Lets say someone were planning to hike the appalachian trail for 6 months and didn't have access to a computer. Could I bring this book, study each day, and know how to program after I'm finished reading?
>>
File: Untitled.png (13KB, 601x289px) Image search: [Google]
Untitled.png
13KB, 601x289px
>xda developers
>>
>>56646049
It teaches you programming but not how to use any of the tools. Imagine you're a carpenter and read about how you make constructions stable and the properties of wood.
>>
>>56646052
What was the commit message?
>>
>>56646087
>fix big breach in security
>>
Whenever I'm given a programming assignment I usually start by working out a plan of what data structures, functions, etc I'll need and how they will all interact together basically using the principles of top-down design I learned in my first semester computer science class.

However when I go to code it, I always end up just doing trial and error shit to get the program to work and it ends up looking a lot different than my plan. This is fine for small simple problems but as we're getting into more complex programs with many more "moving parts", I'm finding I really need to get the design process down.

Are there any tips that anyone can offer me to that end? I'm in second semester programming now and we're using C/C++.
>>
>>56646106
Seriously?
>>
>>56646087
Disable mmap entropy boot abort

(the correct way to fix that is to cherry-pick some kernel changes made by google)
>>
>>56646140
read some books about design pattern and good software architecture.
>>
>>56646074
So realistically, no? yes?
>>
>>56646156
Thanks for the quick response. Are there any particular books you would recommend?
>>
>>56646189
I like Head First design patterns. Gave a lot of good practical advice with good examples etc. Easy enough to digest.
>>
>>56646140
Up front planning is kinda bad because for programming when your plan is done you've already written the program, just in a different language, without any sort of reality checks and without regard for what a computer actually is.

Another approach is to write the program bit by bit as you go. Basically just write your code and presume the functions you need exist when writing. You can write the declarations and definitions later. Usually when you do it that way you end up with the minimum amount of code you need to write and you get a good data flow because you're only passing what you need to the places you need them.
>>
>>56646168
Well you'd have to fiddle with your tools later. You can't expect to sit down and write something after that immediately. But you have a very good starting point.
>>
>>56646215
>Up front planning is kinda bad
You wouldn't happen to work for Microsoft would you?
>>
>>56644814
I don't want to hardcode a specific API in.
And I'm using GLEW, not GLAD.
>>
>>56646156
>>56646201
Design patterns are awful. They're either very narrow in how they're applicable, which make them work well for certain problems but not others. But usually there's no guidance on when to use it because advocates advocate for it absolutely.
Or they're too general and don't really assist your development. Often they just add more to think about for very little reason. They can cause you to do extra work (because you're 'planning ahead' for things that might not happen), make your code less tolerant to changes (the worst imo) and make you less ready to change things because you may have to break the pattern or work without it.
>>
>>56646215
>>56646317


This is what Web Devs actually believe
>>
>>56646265
Nice response to the argument.
I think what I said there in the first paragraph is simply true because planning means you intentionally keep yourself blind. The positive of planning is really that you're writing pseudo code. Which may be more speedy. But for any serious programmer the difference is negligible and if there's situations where you'd wish to do that you can still do that while programming.
>>
>>56646315
Feel free to use whatever OpenGL platform abstraction library, GLFW is just one of them.

On the other hand, GLEW is not that great.
Its generally considered better to use a loader generator and get a consistent set of function for the OpenGL version you're targeting.
GLAD is one such loader, and you can ask it to include all extensions if that's your thing.
>>
>>56646353
>this is what a moron who has never written software on his own and only making 'plans' for his triple digit LOC changes in existing code bases.
>>
>>56646353
dumbass
>>
>>56646168
You would just end up skewed. Like a pianist who knows lots of music theory, technique, proper form, etc, but has no muscle memory.
>>
>>56646317
Their still useful for lots of kinds of problems. You don't need to overthink them. DOn't expect them to solve every problem elegantly.

Their only awful if you expect too much from them.

>>56646362
>but for any serious programmer the difference is negligible and if there's situations where you'd wish to do that you can still do that while programming.
you sound like a terrible programmer. If you're starting a 10k+ loc project, it's worth spending some time planning out what you dependencies will be. Define clearly what you're trying to achieve. Work out what components require what kinds of state to be shared etc.

Planning doesn't stop you from being flexible when you start writing the code, being a shit programmer does that.
>>
File: there_is_no_more.webm (866KB, 720x404px) Image search: [Google]
there_is_no_more.webm
866KB, 720x404px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>56646140
Learn to program by design (HTDP).

Nobody should start to undertake a large project. You start with a small trivial project, and you should never expect it to get large. If you do, you'll just overdesign and generally think it is more important than it likely is at that stage. Or worse, you might be scared away by the sheer size of the work you envision. So start small, and think about the details. Don't think about some big picture and fancy design. If it doesn't solve some fairly immediate need, it's almost certainly over-designed. And don't expect people to jump in and help you. That's not how these things work. You need to get something half-way useful first, and then others will say "hey, that almost works for me", and they'll get involved in the project.

>>56645617
No

>>56644047
Neither
>>
>>56646425
>that vid
just wait until they explain to that kid that life ends
>>
>>56645617
Yes
Yes
>>
>Composition over inheritance when inheritance is the logical thing to do.
Quite possibly the most retarded thing someone could do.

>
abstract class GameObject : IVisible, IUpdatable, ICollidable {
private readonly IVisible _v;
private readonly IUpdatable _u;
private readonly ICollidable _c;

public GameObject(IVisible visible, IUpdatable updatable, ICollidable collidable) {
_v = visible;
_u = updatable;
_c = collidable;
}

public void Update() {
_u.Update();
}

public void Draw() {
_v.Draw();
}

public void Collide() {
_c.Collide();
}
}

Literally pants on head retarded.
>>
File: doompaul.jpg (61KB, 680x512px) Image search: [Google]
doompaul.jpg
61KB, 680x512px
>>56646447
https://en.wikipedia.org/wiki/Immortality#Prospects_for_human_biological_immortality
https://en.wikipedia.org/wiki/Mind_uploading
>>
>>56646487
The fuck?
>>
>>56646487
Working with a codebase with with deep nested inheritance hierarchy's and bloated classes with bizarre edge cases is such fun!
>>
>>56646374
And does GLAD work for pretty much all operating systems?
>>
>>56646487
Inheritance is just a very specific and limiting kind of composition, made by OOP programmers who didn't know what they were doing
>>
>>56646487
that's not really how you do composition.
>>
>>56646407
>it's worth spending some time planning out what you dependencies will be.
Oh yes sure. Decide if you're gonna use external tools or not is one thing. That's not planning _your_ software though.
>Define clearly what you're trying to achieve.
Oh yes. Of course you should know what you're programming. You're not gonna sit down and write something and then somewhere in the middle figure out that you actually didn't want to write a DSP but rather you wanted to write a videogame
>Work out what components require what kinds of state to be shared etc.
You see how you're being sneaky here I hope. Because these things aren't known when you plan.

Software is supposed to be malleable. If you plan and don't immediately throw it to the side you're putting on a blindfold. You cannot be sure about how your program should look when you start because the information is so limited. The best way to navigate is to keep your eyes open and be ready to change direction. Which a plan doesn't help you with at all really.

Knowing what your program is supposed to do is another thing. I don't think anyone has trouble with that type of 'planning'.
>>56646407
You didn't address the cultural problems with them. Where do you find out when it's applicable or not? Can you define a set of applications where they're useful? Can you define a set of functions where they're useful? can you define a set of circumstances within your software which would make the DP applicable or useful?
It's a waste of time anon. It makes as much sense as considering a linked list for every single time you allocate memory.
>>
>>56646528
As long as you have a OpenGL context, its platform agnostic.
>>
1. Write an assignment statement that might be used to implement the following
equation in C.
q = kA(T1 - T2)
L
>>
>>56646487
>inherits from IVisible, IUpdatable, ICollidable
>complains about composition
>>
I'm redoing my emacs configuration. I also plan to learn some elisp and add some stuff like irony mode.
>>
>>56646548
>Decide if you're gonna use external tools or not is one thing. That's not planning _your_ software though.
No, i mean breaking up you project into modules/classes/functions etc at a high level. Figure out what depends on what. What aspects of each dose each other module need to depend on. Does any of this sound familiar to you? Have you red anything about software design?
>>
>>56646567
L?
>>
>>56645940

So it checks if the clicked tile is swappable with the empty tile, then (that is, it is its neighbor)?
>>
File: 藤原-27517&カイ-39.jpg (361KB, 768x840px) Image search: [Google]
藤原-27517&カイ-39.jpg
361KB, 768x840px
I'm at my universities hackathon, /dpt/. Give me your award winning ideas. I'm full stack
>>
>>56646590
>Have you reAd anything about software design?
I have.
>i mean breaking up you project into modules/classes/functions etc at a high level.
So you mean you're gonna tell yourself "I'm gonna have audio output". Does that help you?
And you're not responding to my argument at all you're just repeating yourself.

You can't really have written any large project without having to have thrown a plan to the side. Assuming you're not re-scoping your project to fit what it became.

I have nothing against thinking about the problem, which I think maybe people confuse with planning.
>>
>>56646601
over L*
>>
>>56646643
>I'm full stack
What does this mean?
You claiming to be a girl or something? Why should that matter at a hackathon?
>>
>>56646650
q = (k*A*(T1 - T2))/L
>>
File: 藤原-27517&カイ-1.jpg (1008KB, 1125x649px) Image search: [Google]
藤原-27517&カイ-1.jpg
1008KB, 1125x649px
>>56646659
means I can do front and backend web dev.

And no, I'm a boy with a below average sized penis if you must know
>>
File: gumbrecht-asc.jpg (245KB, 781x635px) Image search: [Google]
gumbrecht-asc.jpg
245KB, 781x635px
>>56646643
A real time youtube to ascii video converter.

So people can watch youtube on their phones without draining data, or watch livestream on the darkweb where there's limited bandwidth.
>>
>>56646686
>web dev
>>>/g/wdg
>>
how do you store −0.42E7 in C? is that a floating point value?
>>
>>56646643
Quake with Multiplayer over WebRTC
>>
>>56646691
>ascii
Why not just compress it more strongly and limit the bitdepth?
>>
>>56646711
float or double
>>
>>56646645
>So you mean you're gonna tell yourself "I'm gonna have audio output". Does that help you?
You sound like you've never written anything big before.

If you're going to have sound output, you consider what kind of code structure would support the need for sound output well. Maybe the audio in your project might be complex enough that something like a SoundManager module/class etc might be justified. If it is, then what does the SoundManager need to know about? In a game for instance, maybe the SoundManager needs to know a lot of information about the current level and camera location, to help calculate how to play sound effects well. Maybe it's better if it doesn't know anything about the level, and instead other code outside the sound manager just tells the sound manager when and how exactly to play sounds without letting it know why they are being played in a certain way. In this case the SoundManager doesn't need to know what a Level is, and this can simplify the code dependencies in the project and make it more maintainable going forward. This are good considerations to make before you write a whole load of code that you can't change easily. Macro-architectural decisions like this are not easy to change after to start writing code and deserve some careful consideration in the preplanning stages.

>I have nothing against thinking about the problem, which I think maybe people confuse with planning.
Making a plan doesn;t mean you have to follow 100% or at all.
>>
>>56646711
Yes, and use a double.
>>
File: 藤原-27517&カイ-5.jpg (557KB, 1600x1131px) Image search: [Google]
藤原-27517&カイ-5.jpg
557KB, 1600x1131px
>>56646691
Would that save bandwidth? a group of like, 7x14 pixels would take up 1 byte, so probably? Idk much about compression. I've worked on something similar before, though: a program which converts 32 bit bmp images to ascii. It was early on when I was a freshman so the code is shit:

https://github.com/collinoswalt/pixelcurse
>>
File: 1460810159228.jpg (9KB, 246x227px) Image search: [Google]
1460810159228.jpg
9KB, 246x227px
>>56644140
I see your confusing function call and raise you whacky printf format specifier.
"%-28s%s\n%-28s%s\n%-28s%s\n%-28s%s\n"
>>
>>56646743
Ok so you're clearly beyond saving. Good evening.
>Making a plan doesn;t mean you have to follow 100% or at all.
So what was the point of the plan? What you just did was think about the problem. Not making a plan. When you've abandoned the plan the use of a plan was just thinking about the problem.

Terrible programmer.
>>
>>56644298
>In my 2011 computer, managed languages like C# or Java that run 100 layers above the OS are extremely slow. Small apps take like 1 minute just to open on Win 8.1, Intel i5 3.2Ghz, latest Java version.
Lies. I have a 2010 laptop with a Core 2 Duo and 4 GB of RAM and most Java apps are almost indistinguishable from native apps in speed, maybe except for the launch time. This is 2016 and Java (and .NET) have JITs and are fast enough. Plus the developer productivity is greatly increased with these, which is another thing to consider. If you said I have a 2006 computer with a Core Solo I would have believed you.

Now don't get me wrong, if you like C and low level APIs are your thing go ahead, the industry needs low level developers too. But the speed argument is a meme.
>>
>>56646788
>So what was the point of the plan?
To explore the problems you might be facing when you make the problem, and try to pick out the best ones to start with. As you start coding you will almost always learn about new things you need to consider and maybe new requirements, and so you have to adjust your plan. But it's never easier to make changes to the overall architecture than it is before you start, so it's worth making a decent effort to make a pretty decent overall design for the codebase at the beginning if you can.

Almost no plans are followed 100% in any aspect of life. I don't know where you got that autistic definition from.

>Terrible programmer.
Apart from disagreeing with your definition of the word "plan", how am i a terrible programmer?
>>
File: le meme snek.png (71KB, 780x530px) Image search: [Google]
le meme snek.png
71KB, 780x530px
When will the dynamic typing meme end?

d = {0: 'abc', False:'xyz'}
d[0] # returns 'xyz'
>>
File: three.png (9KB, 344x135px) Image search: [Google]
three.png
9KB, 344x135px
>>56644004
https://github.com/EZ3CHI3L/Tallis
I made an IRC bot.
Not sure if I'm doing certificate verification correctly, and I still need to do hostname validation.
>>
>>56646842
Ask other people what a plan is and if you throw it away at the first inconvenience do they also consider it a plan?
>How am I a terrible programmer
Well if you've written moderately sized projects as you claim (though 10k+ LOC is really a stretch to call moderately sized. It's still small if written in an imperative programming language). And you have the idea that a plan helps you if you follow it then you're objectively a bad programmer because you don't consider the problem first and foremost. You've put the plan in front of the program and as soon as you do that you've made your program worse.

Either way, as described before you don't know what your program is supposed to be from the outset so planning like that

>But it's never easier to make changes to the overall architecture than it is before you start
Yes, this is true. But you don't know what the overall architecture should be when you start. A plan is a guess at that point. Why would you work in one direction when you don't know what's right? Any decent programmer knows and has felt that they know when they're going wrong more and more the further down the wrong road they're going. If your plan takes you there then yeah you can give up.

But as far as guesses go just writing the simplest possible thing and being ready to change your direction would be many times better than sticking to a plan. Better than sticking to it any amount.

It's not bad to stop in the middle of a project and think "where am I? where do I need to go? what is bad right now?". That's proper planning. Planning when you have information.
>>
>>56646953
fucking javascript...

Every night I pray that TypeScript will take off : (
>>
Could someone please explain to me how conversions/promotions work in C++?
>>
>>56646973
>>Either way, as described before you don't know what your program is supposed to be from the outset so planning like that
is pointless beyond the 'thinking about the problem' part.
>>
File: mfw.png (660KB, 1106x1012px) Image search: [Google]
mfw.png
660KB, 1106x1012px
is it true american software companies don't hire americans to write the code itself? my software development teacher says they outsource the development itself, and the american employees just come up with the requirements and test it
>>
>>56646686
Do you crossdress while you program?
>>
>>56646996
What is there to show?
http://en.cppreference.com/w/cpp/language/implicit_conversion
>>
>>56647012
That happens in some crappy places, but I don't think it's the norm.
>>
>>56646980
>pray
Your little magic rabbi won't grant you any wishes, christcuck.
>>
>>56647012
They damn well don't hire fucking filthy frogposters
>>
>>56647014
No, but sometimes I use the trans bathrooms at my university and dream
>>
File: le animated tip.gif (324KB, 401x353px) Image search: [Google]
le animated tip.gif
324KB, 401x353px
>>56647045
>>
>>56647012
Well it's not always true at least. I have some contact with engineers at GE that are writing software.
>>
>>56647023
Thanks. I'm learning C++ for the first time and I'm working on a small program that takes the average of 3 numbers, but I want to try and make it as memory efficient as possible.
>>
File: Poltards.jpg (81KB, 960x692px) Image search: [Google]
Poltards.jpg
81KB, 960x692px
>>56647045
Poltards confirmed to be tipping fedoratards.
>>
>>56647012
Microsoft, facebook, etc. all abuse the H1B visa system so they can import programmers which they pay way less than Americans. Others will outsource their coding to the Philippines or India.
>>
File: image2.png (359KB, 418x446px) Image search: [Google]
image2.png
359KB, 418x446px
>>56647045
I'm no Christcuck. Everyone knows Anders Hejlsberg is the true son of God.

TypeScript will save us. And the dynamic types will be let burn in hell (which is just using JavaScript for everything).
>>
>>56647110
No, the only son of God (the lambds cube) is Simon Peyton Jones.
>>
>>56647087
>but I want to try and make it as memory efficient as possible.
It's too small to really have any issues with that.
You can put bounds on what's allowed to be input (only accept numbers from 0-255 and you can use char, one byte, to store the numbers).
But beyond that there's no way unless you're being extra inefficient. The simplest solution I can see you doing is as memory efficient as I can think it would be.

Assuming you're not gonna get rid of the C standard library.
>>
>>56647128
>Develops "Useless" language
>Son of God
>>
>>56647087
>a small program that takes the average of 3 numbers
now i find that hard to believe
>>
>>56647142
So is it possible to automatically change the variable type into an int when the input is greater than 255?
>>
Write a program that stores the values 'A' , 'B' , 19 , and −0.42E7 in separate
memory cells that you have declared. Use an assignment statement to store
the first value, but get the other three values as input data from the user in C
>>
>>56647220
no
>>
>>56647087
>>56647165
>Averaging numbers
NO
NO NO NO
NOT AGAIN
>>
>>56647257
pls explain
>>
>>56647234
how do I get the other three values as input data? Use a scanf and ask them to input the values 'B' '19' and '-0.42E7' in char b, int c, and double d respectively.
>>
File: kfc.webm (3MB, 1920x1080px) Image search: [Google]
kfc.webm
3MB, 1920x1080px
Need ideas for a uni project in C# which would involve networking. Any ideas for an interesting project?
>>
>>56647220
What you can do is read the number as an int, store it in a dynamically allocated int. Compare it to see if it's bigger than 255. If not allocate 1 byte for it. Store it in the byte. Read the next two into the old integer you read into and do the same for them. That was you'd keep the minimum amount of memory allocated unless you do the average as you get the integers and just store the average. But it's all pointless.

And i don't advise you to try any of this yet. It's rather pointless and if you wanna get better at programming you should just accelerate your learning than wasting time on this.

This isn't how memory optimization is done either way.
>>
>>56647287
Chat room
>>
>>56647012
For java shit i think it happens.
When you need quality or code that can't be written by any retard like c++ that can't happen.
>>
>>56647287
A decentralized VPN.
Take a few pointers from Tox.
>>
As someone who generally avoids proprietary software, please tell me what use I would have for C#
>>
>>56645118
C/C++ guy here too; how'd you get your gig?
>>
>>56647298
Got it. I'll just finish this and move on.
>>
>>56647339
MonoDevelop. VIsual Studio, Xamarin Studio or Visual Studio Code would be smarter ideas though.
>>
>>56647335
are you being sarcastic with the c++ thing? C on the other hand, the only people i see who program in C at major companies are pasty white guys. have yet to see a single "diverse" C programmer
>>
>>56647319
Chat room for whom? People on the same local network or on the web?
>>
>>56647360
Basically a college near me offers a programming certification. You have to take C++, Python, and C#. I basically dont even want to do it because of the requirement for C#. But if it has uses in my Linux ecosystem I would be OK with it I guess
>>
>>56647287
chat system without "normal" minimize, maximize, close"

bonus for playing web and or mp3 sounds

>>56647319
WOW, we thought the same idea
>>
>>56647381
Whatever you like. I made a web based one years ago. Was fun.
>>
>>56647384
MonoDevelop and/or Visual Studio code then.
>>
daily reminder get used to not using an IDE if you're going to be interviewed
>>
>>56647416
lol what
>>
File: stallman spurdo.png (89KB, 680x433px) Image search: [Google]
stallman spurdo.png
89KB, 680x433px
>>56647416
>using anything but ed and gcc
>>
>>56647012
It happens in other countries too. The main company makes specifications, those get sent to some Pajeet in India and after a month you'll get some code back.

Might not be pretty but who the hell cares as long as it runs and customer pays for it.
>>
>>56647427
apparently when the resume you send to google says "proficient in x", (by x i mean java) they interpret that to mean you don't rely on drop down and autocomplete
>>
>>56647257
ITT: no one can take the average of two ints in C.
>>
>>56647402
I think many people already picked such chatroom projects, I need something better that no one would think of right off the bat, the decentralized VPN seems cool, but I'm not sure I'll be able to pull that off.
>>
File: dad_of_the_year.webm (2MB, 1335x720px) Image search: [Google]
dad_of_the_year.webm
2MB, 1335x720px
>>56647470
int average (const int x, const int y) 
{
if ((x < 0) ^ (y < 0))
return (x + y) / 2;
const int xh = x / 2;
const int yh = y / 2;
const int xhr = x % 2;
const int yhr = y % 2;
return xh + yh + (xhr && yhr);
}
>>
>>56647470
just make a structure that holds a numerator and a denominator and some functions dealing with it
>>
>>56647496
lol naruto is so retarded, i can't believe it's still going on. has it been going on for literally so long that now the characters have aged 30 years? .. there's no way naruto's been going that long i remember watching it when i was a kid and all the characters were kids...
>>
>>56646643
Make a raytracer that utilizes adaptive sampling with all threads on a processor to actually make sensibly fast raytracing. Something like:
https://www.youtube.com/watch?v=Y-95KENuegE
or
https://www.youtube.com/watch?v=sYRFEELWCcY
>>
>>56646622
Ding Ding Ding
Here's your (You)s
>>56646622
>>56646622
>>56646622
>>
Retard time: What's the best software for testing (regression/unit testing), bug tracking and version control?
>>
>>56647540

Nice.
>>
>>56647466
Since when?
>>
>>56647532
It's no longer a silly kids show with serious moments like YuGiOh or similar.
Now it's just serious all the time and the world is in danger all the time.
>>
>>56647532
the story continues through boruto, the son of naruto.

https://mangastream.com/manga/boruto
>>
>>56647470
R8 my implementation

int avg(int x, int y) {
return (x + y) / 2;
}
>>
>>56647365
No i am not.
C++ can get extremely complicated extremely fast.
Do tell me why what i said previously would happen for C but not for C++, i am actually curious.
>>
>>56647595
Doesn't handle overflow
int avg(int x, int y) {
return (x/2)+(y/2);
}

Handles overflow
>>
>>56647614
Wrong result for negative numbers
>>
>>56647557
since two days ago
>>
>>56647614
avg(7,7);//returns 6

AMAZING
>>
>>56647641
>>56647647
I didn't say i averaged integers in C.
I just handled overflow for his function.
>>
>>56647614
avg(1, 1) == 0
>>
>>56647645
You're lying. Stop lying liar.
>>
>>56647466
>drop down and autocomplete
Why does this matter at all? It's editor features. Not language features.

They assume things about editors when you talk about a language?
Incredibly arbitrary.
>>
>>56647595
>>56647614
how about
int avg(int x, int y) {
long i = (x + y) / 2l;
return i;
}
>>
File: 1470691928827.gif (3MB, 307x173px) Image search: [Google]
1470691928827.gif
3MB, 307x173px
THIS IS WHAT I MEANT ABOUT AVERAGING NUMBERS
YOU JUST HAD TO LISTEN
>>
>>56647614
int avg(int x, int y) {
return ((x+1)/2)+((y+1)/2)-1;
}
>>
>>56647706
long can be synonymous to int.
>>
File: map_before_after.png (190KB, 2898x882px) Image search: [Google]
map_before_after.png
190KB, 2898x882px
I made a program who thickens borders and pixels in general, from a bmp map. (in C)
It was a way to improve the bad scan of my map.

Difference is seen with 100% zoom tho.
>>
>>56647744
Oh, the pic is just a sample, the input is the whole map of course (600 mb)
>>
>>56647744
So you basically implemented dilation?
>>
>>56647496
return ((x<0)||(y<0))? (x+y)/2 : ((x/2)+(y/2)+((x%2)&&(y%2))

*teleports behind you*
>>
>>56647774
Maybe, it loops on every white pixel, if 5 of its neighbors are black, the pixel is set to black. Naive.
>>
>>56647835
>if 5 of its neighbors are black, the pixel is set to black. Naive.
Sounds like the housing estate i lived in during college
>>
>>56647835
do you do 1 pass or more than 1 pass? mind trying to do multiple passes to see if it gets better?
>>
>>56647835
Yes, that's dilation.
>>56647906
I laughed, thanks.
>>
>>56647496
They should have had him burn on a candle and unsummon.
>>
>>56647744
>>56647835
Do it in a swirling pattern from the center.
>>
>>56647496
in haskell this is just
average x y = (x + y) / 2
>>
>>56647697
yep. you're not allowed to use an ide, they let you use a text editor and that's it
>>
>>56648009
>you're not allowed to use an ide
Ok? That wasn't relevant to my post at all though.
>>
>>56647287
>>56647495
so...
a demoscene!
>>
>>56648055
This is a good idea.
Easy to do and just some raymarching would impress all the girls.

It's the equivalent of playing the guitar.
>>
File: 1464456213767.png (341KB, 704x528px) Image search: [Google]
1464456213767.png
341KB, 704x528px
>>56648082
>programming
>impress all the girls
>the equivalent of playing the guitar
>>
>>56648082
>This is a good idea.
so this imply you know what is it.

hmmm interesting

>It's the equivalent of playing the guitar.
zozzle
>>
>>56648109
>>56648082
top sys
>>
File: map_before_after.png (28KB, 1016x362px) Image search: [Google]
map_before_after.png
28KB, 1016x362px
>>56647926
>>56647930
>>56647968
Here :
#include <stdio.h>
#include "qdbmp.h"

#define NB 8

struct pixel {
unsigned char r;
unsigned char g;
unsigned char b;
};

unsigned int average(struct pixel *);

int
main(int argc, char* argv[])
{
unsigned int i;

BMP* bmp;
unsigned long int x, y;
unsigned char r, g, b;
unsigned long int width, height;

struct pixel t_average[NB];
/* Array for looping on neighbors */
int nx[NB] = {-1, 0, 1, 1, 1, 0, -1, -1};
int ny[NB] = {1, 1, 1, 0, -1, -1, -1, 0};

if (argc != 3) {
fprintf(stderr, "rescan: %s <input file> <output file>\n", argv[0]);
return 0;
}

bmp = BMP_ReadFile(argv[1]);
BMP_CHECK_ERROR(stdout, -1);

width = BMP_GetWidth(bmp);
height = BMP_GetHeight(bmp);

/* MAIN LOOP */
for (x = 0; x < width; ++x) {
for (y = 0; y < height; ++y) {
BMP_GetPixelRGB(bmp, x, y, &r, &g, &b);

/* White pixel */
if (r + g + b != 0) {
for (i = 0; i < NB; i++) {
BMP_GetPixelRGB(bmp, x + nx[i], y + ny[i], &r, &g, &b);
t_average[i].r = r;
t_average[i].g = g;
t_average[i].b = b;
}
if (average(t_average))
BMP_SetPixelRGB(bmp, x, y, 0, 0, 0);
}
}
}

BMP_WriteFile(bmp, argv[2]);
BMP_CHECK_ERROR(stdout, -2);

BMP_Free(bmp);

return 0;
}

unsigned int
average(struct pixel quad[])
{
unsigned int i;
unsigned int min_n = 0;

for (i = 0; i < NB; i++) {
if (quad[i].r + quad[i].g + quad[i].b == 0)
min_n++;
}

if (min_n >= 5)
return 1;
else
return 0;
}


If there's cringy shit in it, say it. Really.
And an other sample, pic related.
>>
>>56648055
Not really useful on its own and I'm not sure it fits because I need the network component.
>>
File: Day1.webm (3MB, 636x476px) Image search: [Google]
Day1.webm
3MB, 636x476px
>>56648116
Of course I know what a demoscene is. Who doesn't know what a demoscene is?
It's commonly known even among normal people.
>>56648154
Just have the users of the website each control elements of the scene demoscene.
>>
>>56648154
i forgot about this
a multiplayer nethack game?
>>
Anyone else working this weekend? I'm taking the time to carefully review my code. All my diff requests have tons to review ):
>>
>>56648199
The demoscene is the generalized group of demo makers, as in like second reality, crystal dream 2, heaven 7, etc.
>>
File: Capture.png (204KB, 1153x798px) Image search: [Google]
Capture.png
204KB, 1153x798px
>>56647744
Mathematica seems to deliver more readable text.

Erosion instead of dilation because it treats white pixels as true and black as false.

Maybe there's an open source mathematical morphology library for C out there you could look to for methods.
>>
>>56648199
>Just have the users of the website each control elements of the scene demoscene.
That's the thing I don't think I want to do a web service, just a classic desktop app that would use some web API.
>>
>>56648225
demo as in like second reality*
>>
>>56648145
it's cool anon
>>
File: test.png (309KB, 1467x800px) Image search: [Google]
test.png
309KB, 1467x800px
>>56648233

Wow, that's a very good result. I was giving it a go with my own filters, but didn't get anything measurably better.
>>
I have kind of a stupid question, because i think i already know the answer, but i'd kind of like a second opinion.

1>------ Build started: Project: MyExecRefsLib, Configuration: Debug Win32 ------
1> MathFuncsLib.lib(MathFuncsLib.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>main.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
1>MathFuncsLib.lib(MathFuncsLib.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
1>MathFuncsLib.lib(MathFuncsLib.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\Whitewolf\Documents\Visual Studio 2015\Projects\Test Chamber\Debug\MyExecRefsLib.exe : fatal error LNK1319: 2 mismatches detected
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What does this mean, and what do i do about it?
>>
>>56648225
Now you're just being picky anon. A demo is obviously also a rendered scene, a demo scene in singular.

I'm fairly certain anon wasn't talking about the demoscene in that sense. It doesn't even make sense.
>>56648240
You don't have to make excuses, you can say no. Because there's no reason you couldn't do something with a webapi
>>
>>56647234
>>56647273

C people halp pls
>>
File: cringe.jpg (39KB, 600x600px) Image search: [Google]
cringe.jpg
39KB, 600x600px
>>56648286
>Whitewolf
>>
>>56648312
Yes
This is basic stuff anon
>>
>>56648320
I know. It sounded cool when i was 15, and since then it's just stuck.
>>
File: 5eb.jpg (26KB, 600x750px) Image search: [Google]
5eb.jpg
26KB, 600x750px
>>56648286
>Whitewolf
>>
>>56648233
Jesus, it's amazing.
I'm going to test the speed with the whole map. Thanks anon
>>
>>56648336
in sohphomore year of highschool i was on a viking kick and i had wrote in viking runes the word for "elder wolf" on the side of my note paper and the girl behind me in class who was super cute asked me what it was and i told her. i didn't even just brush it off and avoid the question, i told her it was the viking word for "elder wolf"
>>
>Java is one of the most popular languages
how do we fix programming?

>>56648320
>>56648349
at least it's not blackwolf
>>
>>56647234
It's a bit ambiguous. −0.42E7 is probably float and not the string "-0.42E7". So here:
#include "stdio"
int main(){
char a = 'A';
char b;
int n;
float f;
printf("Put B: ");
scanf("%c", &b);
printf("Put 19: ");
scanf("%d", &n);
printf("Put -0.42E7: ");
scanf("%f", &f);
printf("We now have: '%c', '&c', %d, %f\n");
getch();
return 0;
}


I dunno if scanf interprets -0.42E7 as a float or not. If not you need to do more work.
>>
>>56648349
>>56648367
>>56648371
Alright alright, just to clarify, my stupid username is not the bit i'm having issues with, believe it or not.
>>
>>56648410
>
printf("We now have: '%c', '&c', %d, %f\n");

Oops. Obviously
printf("We now have: '%c', '&c', %d, %f\n",a,b,n,f);
>>
>>56648418
you're american, what are you doing trying to relate to vikings anyway
>>
>>56648367
You probably didn't even spell it correctly.
>>
Hi guys, I was asking for a good IDE for Java yesterday. I'm a totally newbie but I tried some languages, Java between them, and I think is not bad to start with.

I used Eclipse in the courses, what do you like?
>>
>>56648418
It seems to be your most pressing issue right now anon. As it's preventing people from helping you.
>>56648430
What does that have to do with vikings? And anyone if free to write using the runic alphabet. Vikings are inclusive like that.
>>
>>56648430
I'm not, i'm not, and i'm not this guy >>56648367
>>
>>56648443
net beans
>>
>>56648461
yes you are. i'm your subconscious, kyle. your id
>>
>>56648430
meant >>56648367
>>
>>56648456
>It seems to be your most pressing issue right now anon. As it's preventing people from helping you.
So it seems. This fact is sillier than the username itself.
>>
>>56648490
At least you don't own a $200 plushie of a pony like SOME people in this thread.
>>
So, I have a file with several double values separated by \t (and \n at the end of each line)

How can I make a C program to read each number into a 2 dim array? fscan doesn't work with the \t and \n
>>
well I'm working on my shitty first site.... burn me nisanbahce.com and tell me how can i carry this site to googles first page while throwing bad design issues at my face
>>
>>56648490
>This fact is sillier than the username itself.
No, I disagree. The name is still very silly compared to this situation.
>>
>>56648443
Netbeans and Eclipse are the only i know

i don't know, i ain't a pro Java
>>
File: 2016-09-17-130915.jpg (1MB, 1600x1200px) Image search: [Google]
2016-09-17-130915.jpg
1MB, 1600x1200px
I'm messing with /dev/fb0 to do various effects(working on plasma right now, but I can't figure out what format the framebuffer is(might be big endian, since it's an ultrasparc T2 machine.))
>>
File: grin.jpg (67KB, 500x684px) Image search: [Google]
grin.jpg
67KB, 500x684px
>>56648504
How do you know?
>>
>>56648549
rainbow effect
NIIIIIIIIICE!
>>
>>56648233
The whole file is too huge sadly
>>
>>56648553
Because he would never forget his trip
>>
>>56648595
What? There existing a plural of $200 plushie ponies in the world is too horrible to consider?
>>
>>56647662
You literally wrote a different function that outputs different values.
>>
>>56648650
Yeah? Well you're a faggot anyway so it doesn't matter what you think.
>>
>>56648667
not an argument
>>
File: 2016-09-17-133221.jpg (161KB, 1600x1200px) Image search: [Google]
2016-09-17-133221.jpg
161KB, 1600x1200px
>>56648549
: )
>>
>>56648410
Thanks.
#include <stdio.h>

int main()
{
char a = 'A';

char b;

int c;

float d;

printf("Input the value B ");
scanf("%c", &b);
printf("Input the value 19");
scanf("%d", &c);
printf("Input the value -0.42E7: ");
scanf("%f", &d);
printf("We now have the values '%c', '%c', '%d', and '%f'\n", a, b, c, d);
getch();
return(0);
}


I get the idea now. In the scanf is the & followed by the variable signifying that this is where we want to store the value?

>>56648325
I know :(
The book is really old though, they give somewhat most ambiguous task with terrible word choice to throw you off. I'm trying with the help of dpt and other supplements
>>
File: another att.png (195KB, 1467x800px) Image search: [Google]
another att.png
195KB, 1467x800px
Well, here's another attempt. Still not as good as an erosion filter, though.
>>
>>56649019
Yeah, but the text is far more readable than mine.

How did you do it ?
>>
>>56648998
The & is the 'address of' operator.
You give the address of the variable to scanf so it knows where to put the information it gets back.
It's used in many different situations though. So beware.
&& is logical and
a&b is bitwise and
&a is address of a.
A bit confusing.

I'm not sure what the book had intended for you to use to get input if you don't know about addresses/pointers already.
>>
>>56649019
maybe try with a spacial index and so something like

-insert pixels
-for every white pixel if black pixels in radius > threshold make it black

it's going to be nlogn but maybe going from a square neighbour to a radius search might help

look at nanoflann on github if you need a spacial index for c++
>>
>Hmm I wonder how the standard library does this
>Like how do you use the tools java gives you to read images
>Better look it up
>It's all interfaces and abstract classes
Seriously every fucking time. Does anyone know some blog or youtube channel or something that explains that sort of stuff
>>
File: another att3.png (88KB, 1467x800px) Image search: [Google]
another att3.png
88KB, 1467x800px
>>56649073

That one was a 3x3 blur kernel then a hard B&W filter.

This one is inv -> 3x3 dilate ({0, 1, 0}, {1, 1, 1}, {0, 1, 0}) -> inv.

Sort of the same effect as Mathematica, except a less intense filter (not all 1s) and also not technically an erosion.
>>
>>56649148
Very cool, I'll try in C
>>
>>56649184

Mine is written in C#, but writing a function to apply a 3x3 kernel should be pretty much straightforward.

There was a good page for it, I'll post the link if I can find it again.
>>
I want to check if a number is a prime number

What I'm thinking is check if a number is divisible by 1 and by 2 and nothing else

Is this possible or am I retarded

In java btw
>>
>>56649274
If it's divisible by 2 (and it isn't 2), it's not a prime number
>>
>>56649274
Yes
Just check for all previous primes instead of all numbers before it
>>
>>56649300
Whoops >>56649285 is right of course
>>
>there are people right now on this board who aren't using go
>>
>>56649285
Oh yea I meant to type "itself "
>>
>>56649335
They're called "good programmers"
>>
Here's the page on 3x3 kernels: http://www.foundalis.com/res/imgproc.htm
>>
>>56649343
do you prefer java and ruby?
>>
>>56649372
no
>>
File: just mess me up big.png (203KB, 328x357px) Image search: [Google]
just mess me up big.png
203KB, 328x357px
!'0'  # returns false
!!'0' # returns true
'0' == true # returns false
'0' == false # returns true


>duck typing
>>
>>56649274
You're retarded. Every number is divisible by 1, and if a number's divisible by 2 it isn't prime.
>>
>>56649402
that's weak typing
>>
>>56649335
A friend did an evaluation of go. His conclusion was that it's good for concurrency, and not much else.
>>
>>56649274
Would this be

(number % 1 == 0 && number % number == 0 [What would I put here] )
>>
Trying to figure out this ELK stack bullshit. Thinking about using it for an IoT application.
>>
>>56649338
It is of course possible, the naive / slow algorithm would be to gather all the primes below that number and then check none divide it (and have a base case, e.g. 2 is prime)
>>
I think I know my problem.
I'm a uni dropout (only got to 2nd year), and the uni I went to was very rigorous...
now I can't get shit done without thinking "I should learn things *properly* before doing anything of value", so in the end, I do nothing, because "doing things properly" actually takes time, effort, and doesn't even assure good results.
in short, I can't do things fast because I have a sort of guilt for not knowing things, and can't learn things, because I feel I could be wasting time. the contradiction is killing me.
>>
>>56649402
# isn't a comment in C
>>
>>56649354
>http://www.foundalis.com/res/imgproc.htm
Many thanks
>>
>>56649435
Ya'll need to learn about wheel factorization.
>>
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
>>
>>56649414
>>56649402
it's neither.
>>
>>56649444
>c
>duck/weak typing
>>
>>56649478
>tfw tomorrow I have to give my report about implementing the sieve in a distributed system
>>
>>56649442
Sounds like you're making excuses.
>>
>>56649471
>the naive/slow algorithm

>>56649490
Yes. C is a weakly typed language. All of anon's examples are the same for C.
>>
>>56649482
no, it's weak typing.
>>
>>56649442
University is bad at teaching you how to make software well.
>>
>>56649442
>I can't do things fast because I have a sort of guilt for not knowing things, and can't learn things, because I feel I could be wasting time. the contradiction is killing me
there's no contradiction here
>>
>>56649402
I don't see the problem here.
>>
weak typing is when you are breaking the type system. it's not the case here.
>>
>>56649538
>weak typing is when you are breaking the type system
No it's not
>>
File: 392578978235.png (196KB, 412x282px) Image search: [Google]
392578978235.png
196KB, 412x282px
>>56649538
>weak typing is when you are breaking the type system. it's not the case here.
>>
>>56649465
>Many thanks

You really ought to thank the guy who brought up erosion/dilation, he was really the winner here.
>>
>>56649538
>>56649549
>>56649550
https://en.wikipedia.org/wiki/Strong_and_weak_typing#Definitions_of_.22strong.22_or_.22weak.22
>>
>>56649564
>These terms do not have a precise definition, but in general, a strongly typed language is more likely to generate an error or refuse to compile if the argument passed to a function does not closely match the expected type. On the other hand, a very weakly typed language may produce unpredictable results or may perform implicit type conversion.

Thanks for the citation anon
>>
>>56649564
like i said, it's weak typing
>>
>>56647496
Why do they have whiskers?
>>
>>56649444
TRIPZ DESERVE IT!!!
>>
>>56649626
Because they can.
>>
>>56649521
Not really. In C, '0' == 48, which is not equal to false/0.
>>
>>56649626
he was posessed by a demon fox

>>56649686
so you're saying that '0' == true returns true?
how intuitive
>>
>>56649704
>true
What?
>>
>>56649686
>c
>false
>>
>>56649686
The fact that would can compare those two different types for equality demonstrates that C is weakly typed.
>>
>>56649704
Does naruto babies have baby foxes in them?
>>56649725
Well he did say false/0. So false in conditional usage and 0 in reality.
>>
>>56649725
c99 has booleans
>>
>>56649532
>something equal to false is truthy, not falsy
Yeah, nothing wrong here
>>
'0' == 0

This always returns false in C
>>
>>56649729
that's not weak typing otherwise operator overloading shall be considered as weak typing.

>>56649686
>>56649729
Weak typing is about if you can circumvent the type system or not. Here an example in C

char b[4] = {'a','b','c','d'};
float *f = b;

The contract that *f is a float and that f is a pointer to float is broken. The soundness of the type system is no more guaranteed, the type system is considered weak.

>>56649402
What PL ?
>>
>>56645841
No they aren't.

Try running Hotspot, Skype, AutoCAD or any other big unmanaged program you know, under drmemory/valgrind and if you don't see a ton of memory leaks and invalid accesses I'll stop doing drugs.
>>
>>56649729
They're not different types. Chars are 8-bit integers in C.
>>
>>56649793
>that's not weak typing otherwise operator overloading shall be considered as weak typing.
It is if it's built into the language, jesus christ. If a language implicitly converts types between each other a lot, it is weakly typed.

In a strongly typed language '0' == 0 would not compile.
>>
if ('0')
...

if ('0' == true)
...

These do different things.
>>
I need to make a custom project configuration for Visual Studio, that compiles a library with both debug and release RTLs in one go.

How do?
>>
>>56649825
if (!x)
and
if (x == false)
should do the same thing
>>
>>56649825
lmao '0' is 48
true is 1
ofc they won't be equal, but '0' evaluates to a true statement
>>
>>56649822
>If a language implicitly converts types between each other a lot
what is "a lot" ? how do you measure that ?
>>
>>56649779
Wat?
>>
File: 1462666392038.jpg (57KB, 415x440px) Image search: [Google]
1462666392038.jpg
57KB, 415x440px
>>56649852
>a evaluates to true
>a == true evaluates to false
>>
>>56649847
depends the semantics of the programming language.
>>
>>56649860
>'0' is equal to false
>'0' acts like true, not false, in conditional expressions
>>
>>56649864
fuck you
>>
>>56649854
>what is "a lot" ?
when most primates can be implicitly converted between one another, it's a lot.
>>
>>56649884
primitives*
>>
>>56649876
Oh, that IS stupid.
>>
File: 1420082272538.jpg (44KB, 312x322px) Image search: [Google]
1420082272538.jpg
44KB, 312x322px
> 1 year into programming
> C#, spent a couple of months trying out C++, C, Python, Java, D, and Go.
> I can now read code and figure out what is going on, at least to a basic degree.
> I am now getting to the point where I can practice on my own and begin to transition into turning my ideas into working code
>Suddenly almost overnight CODING IS FUN

jesus christ what a rush.
>>
>>56649884
Chars are a subset of ints. Of course they can be implicitly converted into ints.
>>
>>56649421
and what are your friend's credentials?
>>
Anyone who thinks unit testing is useless has never written anything past fizzbuzz.
>>
>>56649920
im 1 yo old too
yeah feels ok, though it hits me hard theres so much i dont know
>>
>>56646953
False is synonymous with 0. You just overwrote the key.
>>> int(False)
0
>>
>>56649930
i know
>>
>>56649982
>False is synonymous with 0
>>> False is 0
False
>>
>>56650005
>doesn't know how is works
Nice try
>>
>>56649982
no it's not. What made you think that?
>>
new thread when?
>>
>>56649920
>1 year
>6 languages
>CODING IS FUN

oh...
i wish do things like that
>>
>>56650040
print False*1000
>>
>>56650040
Because that's literally how it works.
>>> d = {0: 1, False: 2}
>>> print(d)
{0: 2}


Bool is a subclass of int
>>> isinstance(False, int)
True
>>> isinstance(0, int)
True
>>
>>56650069
never
this is the last one
>>
New thread:

>>56650100
>>
>>56650079
False gets implicitly converted to a number in order for that to work.

>>56650095
Same here. False is being implicitly converted to a number, because you can't use a boolean as a key in an object.
>>
>>56649864
Please learn programming before coming into these threads.
>>
>>56650145
print True + True == 2


its True
>>
>>56649968
He's very friendly.
>>
>>56650171
Again, True is being implicitly converted to a numer. "+" does not work on booleans, so JavaScript converts the booleans to something it can use "+" on, which is in this a number.

try "String" + True + True in JS. Should come out as "StringTrueTrue" if I'm not mistaken, because the implicit conversion will convert them to strings instead.
>>
In Java I'm supposed to create a program that prints pic related

Am I stupid or is this not possible
>>
>>56649972
I've not figured out a way of writing automated game tester.
Though i've heard the No Man's Sky team have.
>>
>>56650208
This is Python.
>>
>>56650208
nah mate, True is literally an int, as much as it is an object

that's why + works, it's a method

i don't know about javascript
>>
>>56650213
Easy.

System.Out.println("");
>>
>>56650213
>prime numbers
>that are also divisible by 3 and 5
>>
>>56650213
>Java
If it weren't for it's retarded userbase, I might actually try java.
>>
>>56650213
i have one week experience in java a year ago

here
print 5
print 3


here
>>
>>56650331
>3 and 5
>prime numbers
>burger education
>>
>>56650380
>3 and 5 aren't prime
>>
>>56650254
>>56650213
Okay so it must have been a trick question or something

Inb4 I fail the assignment
>>
>>56650306
Javas userbase is a reflection of the language.
>>
>>56650407
The assignment said divisible by 3 AND 5 AND a prime number
>>
>>56650415
This. Any Java programmer smart enough to be aware of all the inherent flaws in Java and know about the alternative options, is no longer a Java programmer.
>>
>>56650213
wtf
this is a ripoff of /dpt/ prime fizzbuzz
>>
>>56650432
but 3 and 5 are divislbe by 3 and 5
3 is divisible by 3 and 5 by 5
>>
>>56650213
They want a list of primes that are divisible by 3 and divisible by 5, or do they want the union of a list of primes that are divisible by 3 and a list of primes that are divisible by 5.

In the first case {}, in the other case {3, 5}
>>
>>56650479
3 is not divisible by both 3 and 5
>>
>>56650512
>3 is divisible by 5
you wot mate?
>>
>>56650494
I'm almost 100% sure it's the second one

Instead of putting system.out.print("") ;

I put

for(int number = 1; number < 100 && number >= 1; number++){

if(number % 3 == 0 && number % 5 == 0){

System.out.println(number);
}
}

//the assignment said prime numbers 1-100 and is also divisble by 3 and 5 which is not possible so i think its a typo
>>
>>56650528
Idiot

Get a trip so I can block you
>>
What's it like working on a flight simulator?
>>
>>56650853
It's like a big warm apple pie.
                                                                                                              PS: this thread is dead
Thread posts: 375
Thread images: 44


[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.