[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: 30

File: Walter_Bright.jpg (71KB, 600x800px) Image search: [Google]
Walter_Bright.jpg
71KB, 600x800px
What are you working on, /g/?

Previous thread: >>59172907
>>
File: 1468048836286.png (284KB, 650x581px) Image search: [Google]
1468048836286.png
284KB, 650x581px
>>59177041
>C(ancer)""""++""""
>>
File: Delphi.jpg (24KB, 260x321px) Image search: [Google]
Delphi.jpg
24KB, 260x321px
Is Object Pascal, dare I say it, /ourlang/?
>>
Branching into making GUIs since I released people are too stupid to use CLI in 2017
>>
>>59176997
bumping for help
>>
>>59177067
Trash.
>>
C is GOD
>>
Reposting in new thread:

Why is C++ networking programming such a clusterfuck? cpp-netlib and asio rely on boost, and even if they don't it's a mess of namespaces and other junk. I really want to use C++ for a server project, but I'll have to stick with Java because its standard library actually has a network api...
>>
>>59177190
Any reason you can't use socket.h or winsock?
>>
File: no.jpg (52KB, 420x346px) Image search: [Google]
no.jpg
52KB, 420x346px
>>59177041
>not an anime op
Thread officially ruined
>>
>>59177190
Because C++ is shit.
>>
>>59177219
that's even more of a clusterfuck if you're used to c++14
>>
>>59177219
Cross platform-ness. If I understand correctly, socket.h is UNIX, winsock is Windows. Besides, to the best of my knowledge, those are both C.

If there's something missing, I'll gladly learn about it.
>>
Hey boys~

I've recently been exploring two Scheme implementations; Guile and Chicken. Overall I'm favouring Chicken more, both for rational reasons (Eggs are far easier to work with) and irrational reasons (GNU and FSF are disgusting bureaucrats who ruin everything)

At present, I'm thinking about going nose to the grindstone and working on something significant in Chicken Scheme, however I'm a little apprehensive - should I just bite the bullet and go for it, or is this perhaps a fool's errand and I should just use Common Lisp like the rest of the world?
>>
>>59177577
>irrational reasons (GNU and FSF are disgusting bureaucrats who ruin everything)
How the fuck is that an """"irrational"""" reason? If anything, your first reason is more "irrational" than this.
>>
Working on a GUI here.
Is it better to keep the GUI in a class or within the main program itself?
>>
>>59177621
nigga you even mvvm or mvc?
>>
>>59177621
I don't know what you mean anon, are you writing a GUI library like GTK to wrap win32/x11 based on target platform? Are you writing a GUI system in opengl/directx?
>>
File: asd.png (57KB, 473x220px) Image search: [Google]
asd.png
57KB, 473x220px
What is the easiest way to line these all up nicely? Or do I have to do the calculations manually?
>>
>>59177735
>python
why don't you ask on reddit?
>>
>>59177735
just use iomanip and column widths
>>
>>59177067
Object Pascal is essentially Rust for non-hipsters.
>>
>>59177745
This is for python

>>59177744
Why are you so angry?
>>
>>59177751
Did I sound angry? I just told you to go back to where you belong, no hard feelings, "buddy"
>>
>>59177735
Pad it using a printf control code. (lol if python doesn't support it)
>>
>>59177735
Don't you have some string-formatting functions in your meme language?
>>
>>59177735
Just calculate the max width per column and pad the rest to equal that width. Not that hard.
>>
>>59177768
>meme language
go join that retard on reddit.
it isn't a """"meme language"""", it's just plain trash.
>>
what is the best algorithms book?
>>
>>59177747
>Object
Didn't even read any further but I already know it's garbage
>>
>>59177735
tabstops you retard
>>
>>59177782
fuck you faggot, object oriented design is the next big thing and its gonna dominate the rest of the 90s and 00s!!!

We will send objects over the internet instead of abstract data so that the data can operate on itself when it arrives!
>>
Should I learn C#?
I mostly use Linux, but people says is a good language for multiplatform applications...
>>
>>59177790
kek
>>
>>59177800
It's fucking garbage.
>>
>>59177800
Just learn Java, its on more platforms.
>>
>>59177800
It's basically Microsoft's version of Java. You won't see much use for it outside windows machines IMO, but it's pretty intuitive and looks good on a resume.
>>
>>59177809
It's fucking garbage though.
>>
>>59177800
how is c# multiplatform? only with xamarin you can dev ios and android apps. no mac or linux
>>
>>59177800
Man, are you seriously so peer-pressured by /g/ that you'd use C# over Java for multi-platform? Sure it's a prettier language but it's worse in pretty much every conceivable way for the task.
>>
>>59177826
Both are ugly as fuck and should be avoided at all costs.
>>
which programming language has the highest chance of making me the most moneyyy
>>
>>59177190
Have you tried sockets? Ever programmed a networked application in C? Learn something and don't use a library for once.

Also libevent.
>>
>>59177830
Your own language.
>>
useful tip of the day:
if gcc complains about missing template instantiations for a function that isn't even a template, it's actually because of an auto argument which creates a template behind the scenes.
just discovered this.
>>
>>59177735
Oh boy. Man are you going to love this link.
https://docs.python.org/3.6/library/string.html

Especially the Format Specification Mini-Language portion

Do people not consult the documentation before running for help?
>>
>>59177835
socket programming without exceptions, just shoot me now senpai.
>>
>>59177830
Honestly COBOL or Fortran
>>
>>59177855
most questions on /g/ can be answered with RTFM
>>
>>59177878
I can understand some questions being asked because they are more abstract and if you can't pinpoint the root problem you can't read the manual but shit like string formatting? Holy shit. Just fucking read the documentation.
>>
>>59177764
Dont think its supported

>>59177784
The fuck is that?

>>59177855
I do use string format but I don't think theres any easy way to line up the header (the hard coded print statement up top) be in line for every element I print out
>>
>>59177966
>Dont think its supported
The string format thing should be able to handle it.
>>
>>59177966
>I do use string format but I don't think theres any easy way to line up the header (the hard coded print statement up top) be in line for every element I print out

Align you mother fucker.
Do you even know what Align is?
Did you read
>If a valid align value is specified, it can be preceded by a fill character that can be any character and defaults to a space if omitted.

Please FFS read the fucking documentation. I literally already spoonfed you. What is your end game? You want me to write your code for you?

Here is your psuedo code

Fill with String, set alignment after the spacing you want. Fill with String. Repeat till you have proper alignment.
>>
>>59178078
>What is your end game?
Would you perhaps be interested in knowing the next step of his master plan?
>>
>>59178078
how does one get good at reading documentation and knowing what he needs for a specific problem?
>>
>>59178157
Crashing /dpt/ with no survivors.

Python is the best language
>>
>>59178170
just read the entire thing once, its not that bad, and you can generally skim a lot of it because it will be repetitive or obviously things you won't need.
>>
>>59178170
Learn how to use Google and control f. The rest comes with experience.
>>
>>59178170
Identify problem
>Hmm I need to align my text
Look at current implentation and the tools being used
>Well I am using string to print out my text
Look at X documentation
>Since I am using string, lets look at its documentation and see if I can identify inbuilt methods to solve my problem

There
>>
For some god damn reason I decided I wanted to learn C, C assembly, and C++ all at the same time to build onto this os.

http://vmwaros.blogspot.com

Its actually pretty cool it just has shit drivers and no one wants to make it better 3: all the devs are worried about the SMB and 64 bit compatibility that they will never use.
>>
>>59177966
just \t anon
>>
>>59178207
\t doesnt werk in a general case, if certain strings are too long it'll come up looking fucked
>>
>>59177041
I'm working on making this site not blinding as fuck to myself.
Source, am retarded and going to sleep now.

>Forgot to bind scrot to printscreen
>>
>>59178327
Is CSS programming?
>>
>>59178327
just use 4chanx and oneechan, dumbass
>>
>>59178345
Nah. It's scripting though.
>>
File: GURERILLA.png (80KB, 1907x648px) Image search: [Google]
GURERILLA.png
80KB, 1907x648px
>>59178327
just use tomorrow style gorilla
>>
File: hmm.png (81KB, 758x614px) Image search: [Google]
hmm.png
81KB, 758x614px
>>59178327
waste of time
>>
I have a question for all you C programmers. What projects have you done in C? What kind of things do you personally use C for?
>>
>>59177041
my poli sci minor
>>
>>59178681
socket programming is bretty fun
>>
>>59178681
- University assignments
- Firmware on microcontrollers (majority)
- Libraries that are to be used by a variety of different programming languages (mostly stuff that communicates with said microcontrollers)
The latter two professionally.
>>
>>59178681
I haven't programmed very much lately, but in the past I've written a few programs (for myself) in C. Quite often, even before starting, I thought C probably isn't the easiest language to to do in, but often it was just for the learning experience or testing something out, and I think C is a no bullshit way of learning to do something.

I wrote:
An IRC bot that grabbed shit off of other IRC bots with XDCC.
An audio visualiser with OpenGL.
A JSON parser/implementation.
A shitload of smaller, usually single file programs doing all sorts of shit.
Some shitty X11 program which didn't actually do anything (I was just drawing shit).
The flimsy start to a Wayland compositor (Again, I just got to point of drawing shit).
Several university assignments where the choice of language was up to up (Most of them involving networking).
And another whole other bunch of half-baked project ideas.

Most of the stuff I actually wrote which are the most useful to me, and which I actually use regularly are just bash scripts.
>>
>>59178769
>up to up
up to us*
>>
Should I learn Ocaml or standard ML?
>>
>>59178816
sml
>>
>>59178913
reasons?
>>
>>59178933
Actual standard
Multiple implementations
Saner syntax
>>
I tried to learn rust, I tried...

But fucking hell. Why does it try so hard to be different about fucking everything? Not even remotely similar.
>>
>>59178816
Neither, ml is fucking useless.
>>
>>59179000
Why should it be similar? To accommodate retards such as yourself?
>>
>>59177041
A controller for the drive by wire accelerator in my car.
>>
>>59177775
Dijkstra for Dummies
>>
>>59179032

It's akin to learning a deep African tribal language, instead of German.

I mean sure, the Africans can run fast, and yeah, the Germans have a bit of a overflowing issue. But at least I'm able to converse with more than the local Shaman.
>>
>>59178980
>Multiple implementations
Which one should I use, smlnj?
>>59179010
it would be useful to me so it's by definition useful.
>>
>>59179066
>that extreme case of reddit spacing
Post disregarded. Didn't even read it.
>>
>>59179093
>reddit spacing
What the hell are you even talking about? Is this fucking "meme arrows" for 2017?
>>
>>59179105
Analyze your post, maybe even a retard like you will be able to understand. Hint: you didn't do it this time (which leads me to believe you actually know what it is)
>>
>>59179058
These algorithms have something common in their cores. They use a while loop for traversing nodes and a data structure which defines an order of an evaluation of that loop.

BFS uses a queue, DFS uses a stack, Dijkstra uses a priority queue.

I like Cormen's book on algorithms, it's more concise in comparison to Knuth's ones. I would also recommend MIT OCW 6.006, 6.046 and 6.851, they have online video lectures.
>>
is it normal for gcc to ignore volatile at -O3?
>>
>>59179141
No. You're probably doing some other stupid shit.
If you're modifying from a signal handler, it should only be a volatile sig_atomic_t.
>>
>>59179000
What do you mean? Example?
>>
>>59179164
volatile int count = 0;
int tmp = 0;
while (true)
{
if (tmp != count) std::cout << '!';
tmp = count;
}

I'm doing this. count is being incremented in an interrupt handler.
when I disassemble it, the loop is still there, but it drops a jmp +0 before it even enables the interrupt.
>>
>>59179248
Is that indicative of the whole program? Is "count" really in the same scope as the rest of it?
GCC (rightfully so) will still skip volatile checks if it can reason that something can never change.

Post the whole, compilable bit of code. People can't tell what the hell is actually going on if you cherry-pick bits of your program and leave out what could be very important details.
>>
>>59179287
>GCC (rightfully so) will still skip volatile checks if it can reason that something can never change.
But it shouldn't. Because it really can't reason that.
Sounds more like whoever fit GCC to a microcontroller fucked up (or generally has no clue).

> An object that has volatile-qualified type may be modified in ways unknown to the
> implementation or have other unknown side effects. Therefore any expression referring
> to such an object shall be evaluated strictly according to the rules of the abstract machine,
> as described in 5.1.2.3
>>
>>59179287
int jwdpmi_main(std::deque<std::string> args)
{
std::cout << "Hello, World!" << std::endl;
volatile int count { 0 };
jw::dpmi::irq_handler h { [&](auto ack) { ++count; ack(); }, jw::dpmi::irq_config_flags { } };
h.set_irq(0);
h.enable();
jw::io::out_port<byte>{0x43}.write(0x34);
jw::io::out_port<byte>{0x40}.write(0xFF);
jw::io::out_port<byte>{0x40}.write(0xFF);
int tmp = 0;
while (true)
{
asm volatile("":::"memory");
if (tmp != count) std::cout << '!';
tmp = count;
}
}

Yes it's in the same scope. here's my main function. I'm not going to post the whole irq_handler class here.
the interrupt handler is a lambda function (that's the whole thing I'm experimenting with) which captures the counter by reference. so I don't think gcc has any way of assuming it will remain zero.
>>
>>59179332
>But it shouldn't. Because it really can't reason that.
If it's an automatic (stack allocated) variable, and a pointer to it has never been taken and given to somewhere else (i.e. it could be register qualified), it can assume that it can NEVER change, as there is no way for it to.
>>
>>59179000
Cheked. I know that feel. Rust is fucking insane. I got used to D so quickly in comparison. Thinking in Rust way is like learning how to use your left hand to do daily tasks.
>>
>>59179364
Unfortunately, this is not how computers and interrupts work. I guess it'll works in some ivory tower magic machine though.
>>
>>59179357
Jesus christ, C++ is such a fucking shitshow. How do people defend this garbage?
I don't know the semantics of C++'s god-awful lambdas, and whether they take a reference to or a copy of a variable.
>>
Can I not use the omega combinator in haskell?
>>
>>59179380
There is no way for an interrupt handler to modify automatic memory without undefined behaviour (unless a pointer is taken and stored somewhere).
I don't see why an aggressive optimising compiler could not take advantage of that?
If you're going to bring up MMIO or whatever, that shit isn't on the stack. They are just random pointers to some other place.
>>
>>59179431
The point is that an interrupt will modify the program counter to a (hardware-)defined address. A compiler doesn't/can't know that though and will completely optimize away functions that are "never called". The point following up to that is that the compiler shouldn't optimize the function away if a volatile variable is being read or written..
>>
>>59179383
>Jesus christ, C++ is such a fucking shitshow. How do people defend this garbage?
What's your problem with that code exactly?
>>
>>59179383
>i don't understand it
>hurr durr it's the language's fault
I don't see you naming any alternatives either.
>>
>>59179452
The compiler knows that the volatile variable isn't "real", though. It would just treat it like any other automatic variable, and probably optimise it away.
Again, if the variable was actually accessible from outside the function (or was static), then it would be wrong to optimise it out.
>>
>>59179469
It's fucking hideous.

>>59179472
>>i don't understand it
I understand what the code is trying to do. I just don't know enough about the semantics of C++'s quadrillion "features" to be able to answer the question.
I was hoping that his code would be somewhat benign (but still stupid) "C with classes" or whatever.
If C++ lambdas take an implicit reference to count, I don't know what the hell is going on.
If C++ lambdas take an implicit copy of count, the test is failing because count never actually changes.
>I don't see you naming any alternatives either.
Why would I need to provide an alternative? I'm not here to change his fucking programming career or something.
I'm just expressing my disgust with C++ and people who fall for its tricks.
>>
>>59179525
I'm not sure what's hideous about it without resorting to addressing subjective matters but in any case count is passed to the lambda as a reference as denoted by the ampersand in the capture list group.
>>
>>59179525
the [] bit dictates capture semantics
[&var, var2]
capture var by reference, var2 by value

[this]
capture this pointer

[&]
set default capture to be by reference

[=]
set default capture to be by value

[]
no capture
>>
>>59179473
Are you deliberately missing the point?
The point is a compiler for microcontrollers shouldn't optimize a volatile variable (or function) away ever. Regardless of what the standard says. Because it can't tell.
Because if it does then one would have to call it 'defective'.
>>
>>59179555
>>59179559
I don't fucking know then. Are you even setting up the interrupt handler correctly, or whatever "jw::dpmi::irq_handler" is supposed to do?
Also, it would probably just be a better idea to use an atomic int for shit.
>>
what's the 4k monitor for the best coding experience?
>>
>>59177041
How the fuck do I get wasm to work? Ubuntu 16.04.

"Exception thrown, see JavaScript console"

Everything looks fine when I set up the env and compile.
>>
>>59177067
>Object Pascal
Object Pascal doesn't really exist in a distinct form any more. Apple abandoned it.
>>
>>59179723
The gamer monitors
>>
>>59179762
Did you try to see the JavaScript console?
>>
>>59179700
turns out I was mistaken, the infinite loop happens before the one in the main function. there's a function that adds up the irq_config_flags for all irq_handlers that have been assigned to the same interrupt:
void add_flags() { flags = { }; for (auto p : handler_chain) flags |= p->flags; }

that turns into an infinite loop somehow.
>>
>>59179804
dont lie to me, anon. you will go to hell for this.
>>
>>59179835
It's not helpful.

"Uncaught TypeError: WebAssembly.instantiate is not a function"

input valid C code, get errors
>>
>>59179942
Are you using a "stable" browser where WebAssembly hasn't been enabled by default yet?
>>
>>59179942
Why are you using JavaScript?
>>
>>59179846
Is handler_chain a custom container? Does it implement the end iterator properly?
>>
>>59179762
>>59179942
The current WASM spec is undocumented and poorly implemented. Talking from personal experience. Wait another year or so.
>>
>>59179980
It's a plain std::deque with pointers to the irq_handlers. The literally turns this loop into one jmp +0 instruction.
>>
>>59177242
>those are both C.
True.

But when you're making something in C++ being a C++ zealot who only accepts Bjarne as your one true god isn't healthy. The language is based on the idea of improving on C++. And they may have largely failed but there's still some C in that mess.

I'd use it as much as I can.
>>
I was gonna add raymarched shadows to my renderer but when searching all I can find is technical documents which aren't really concerned with the basics or Unreal engine documentation page (which tells you nothing but the tradeoffs and how much more awesome raymarched distance field shadows are than CSM).

Where should I read about this?
Is there a good (preferably modern) book on rendering techniques?

And I could probably just get by having a good algorithm to generate a distance field for the view. The rest is relatively easy I'm assuming.
>>
/g/
i solved the problem yesterday but this time we got different problem. When i minimize the JFrame i lost all rectangles. What should i add to code?

 
package ArrayLists;

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

public class array extends JPanel implements KeyListener{

ArrayList<Rectangle> rec_list;
Rectangle r;
int rnd_1, rnd_2;
Random rnd = new Random();

public array(){
rec_list = new ArrayList<Rectangle>();
Add_array();
}

public void Add_array(){
rnd_1 = rnd.nextInt(400);
rnd_2 = rnd.nextInt(400);
r = new Rectangle(rnd_1, rnd_2, 25, 25);
rec_list.add(r);
}

public void paintComponent(Graphics g){
super.paintComponents(g);
g.fillRect((int)r.getX(),(int)r.getY(),
(int)r.getWidth(),(int)r.getHeight());
repaint();
}

public void keyPressed(KeyEvent k) {
int key = k.getKeyCode();
if(key == KeyEvent.VK_SPACE){
Add_array();
}
}

public void keyReleased(KeyEvent arg0) {
}
public void keyTyped(KeyEvent arg0) {
}

public static void main(String[] args) {
JFrame frame = new JFrame();
array a = new array();
frame.addKeyListener(a);
frame.add(a);
frame.setSize(400,400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
>>
Can /g/ recommend me some simple 2D drawing library for python? Just enough to make some quick visualizations.
I downloaded something called "graphics.py". It lets you draw some shapes to a window, do simple transformations, do some I/O etc., which is perfectly fine for what I need, but it doesn't let you to draw whole bitmaps at once - you have to draw them on per pixel basis which is horribly slow.
>>
>>59180129
I'm sure python has a million wrappers over SDL.
>>
>>59179955
Yeah, but I enabled wasm. Their demo works. I also got this same error on Canary for Windows.

>>59179958

I'm not.

>>59179998

I think I'm going to just do this. Their devs weren't helpful either. Fuck it.
>>
I think the NSA is making companies like MS and Google to anti-shill Rust. Rust makes security exploits harder to produce. This is is against the interest of the NSA and they want to prevent Rust in any way possible.
>>
>>59180132
You can technically run WASM right now, but it requires 1000 loc of wrapper JS. I wouldn't use wasm in production, until you can simply
import foo from "./my_wasm_module"
.
>>
>>59180138
>Rust is being shilled HARD and people get annoyed
>IT'S TOTALLY THE NSA YOU GUIZ
>>
>>59179980
>>59180016
Added some labels:
void add_flags() 
{
asm("a_%=:":::);
flags = { };
asm("b_%=:":::);
for (auto p : handler_chain)
{
asm("c_%=:":::);
flags |= p->flags;
asm("d_%=:":::);
}
asm("e_%=:":::);
}

This turns into:
00005d43 <a_4360>:
5d43: 8b 8d fc fe ff ff mov ecx,DWORD PTR [ebp-0x104]
5d49: c7 41 40 00 00 00 00 mov DWORD PTR [ecx+0x40],0x0

00005d50 <b_4365>:
5d50: 8b 41 10 mov eax,DWORD PTR [ecx+0x10]
5d53: 8b 51 14 mov edx,DWORD PTR [ecx+0x14]
5d56: 3b 41 20 cmp eax,DWORD PTR [ecx+0x20]
5d59: 8b 51 18 mov edx,DWORD PTR [ecx+0x18]
5d5c: 8b 51 1c mov edx,DWORD PTR [ecx+0x1c]
5d5f: 8b 51 24 mov edx,DWORD PTR [ecx+0x24]
5d62: 8b 51 28 mov edx,DWORD PTR [ecx+0x28]
5d65: 8b 51 2c mov edx,DWORD PTR [ecx+0x2c]
5d68: 74 07 je 5d71 <e_4436>
5d6a: 8b 00 mov eax,DWORD PTR [eax]

00005d6c <c_4421>:
5d6c: 8b 40 10 mov eax,DWORD PTR [eax+0x10]
5d6f: eb fe jmp 5d6f <c_4421+0x3>

00005d71 <e_4436>:

These are the | and |= operators. (irq_config_flags is an enum)
inline constexpr irq_config_flags operator| (irq_config_flags a, auto b) { return static_cast<irq_config_flags>(a | b); }
inline constexpr irq_config_flags operator|= (irq_config_flags& a, auto b) { return a = (a | b); }


Am I doing something stupid? I don't see any problems here.
>>
>>59180138
There might be a possibility. I've seen people shill closed source compilers and C based DRM runtime languages like C#.
>>
>>59180190
what the fuck, why is it loading edx five times in a row?
>>
>>59180208
Microsoft already took this route and tried to slip in their own spyware in guise of telemetry in the MSVSC compiler
>>
>>59180130
so, which one would /g/ recommend?
>>
>>59180190
Seems alright, kinda random but what if you try:
a = a | b;
return a;


Instead of assignment in return.
>>
>>59180190
>>59180247
If there's an issue I suggest you test this with unit tests rather than by code inspection.
>>59180190
The entire code here is just dead code. Most decent compilers will not turn off optimizations just because you did some asm. Print the result or something.
>>
>>59180273
>Most decent compilers will not turn off optimizations just because you did some asm
I placed the asm labels in there so they would show up in the disassembly, not to change the optimization level. Why is is generating dead code for a seemingly valid for loop?
>>
>>59180310
I'm not sure hy this surprises you at all. ALl you're doing is assigning values from p.flags to a local variable that you're throwing away at the end of the loop.

Add this functon
void escape(void* p)
{
asm volatile("" : : "g"(p) : "memory");
}

Call it at the end of the function.
Assuming this is GCC. Then it should actually do something.
What pointer you pass doesn't matter.

Because as you can clearly see from your assembly it's doing nothing but movs and jumps.
>>
>>59180362
And I don't know why there's even movs, compares and jumps. I would have thought the entire loop would be gone and it concerns me that it isn't.
>>
>>59180362
>ALl you're doing is assigning values from p.flags to a local variable that you're throwing away at the end of the loop.
flags is a class member variable here so I'm not throwing it away.
Your escape function, should I place it inside the loop or just outside it?
>>
File: 1461979053149.png (12KB, 722x452px) Image search: [Google]
1461979053149.png
12KB, 722x452px
Making an operating system.
ACPI is for homos.
>>
>>59180509
>Your escape function, should I place it inside the loop or just outside it?
You just need to call it inside the function where the local variable is in scope.
It clobbers memory.
See http://stackoverflow.com/questions/33975479/escape-and-clobber-equivalent-in-msvc (the talk is good but the SO thread is more concise and relevant to what we're talking about here).
>>
>>59180554
I know what a clobber/fence is but I don't see how it would help in this case. It's still generating the same garbage too:
void add_flags() 
{
asm("a_%=:":::);
flags = { };
asm("b_%=:":::);
for (auto p : handler_chain)
{
asm("c_%=:":::);
flags |= p->flags;
asm("d_%=:":::);
}
escape(reinterpret_cast<void*>(this));
asm("e_%=:":::);
}

void escape(void* p)
{
asm volatile("" : : "g"(p) : "memory");
}

00005d43 <a_4360>:
5d43: 8b 8d fc fe ff ff mov ecx,DWORD PTR [ebp-0x104]
5d49: c7 41 40 00 00 00 00 mov DWORD PTR [ecx+0x40],0x0

00005d50 <b_4365>:
5d50: 8b 41 10 mov eax,DWORD PTR [ecx+0x10]
5d53: 8b 51 14 mov edx,DWORD PTR [ecx+0x14]
5d56: 3b 41 20 cmp eax,DWORD PTR [ecx+0x20]
5d59: 8b 51 18 mov edx,DWORD PTR [ecx+0x18]
5d5c: 8b 51 1c mov edx,DWORD PTR [ecx+0x1c]
5d5f: 8b 51 24 mov edx,DWORD PTR [ecx+0x24]
5d62: 8b 51 28 mov edx,DWORD PTR [ecx+0x28]
5d65: 8b 51 2c mov edx,DWORD PTR [ecx+0x2c]
5d68: 74 07 je 5d71 <c_4421+0x5>
5d6a: 8b 00 mov eax,DWORD PTR [eax]

00005d6c <c_4421>:
5d6c: 8b 40 10 mov eax,DWORD PTR [eax+0x10]
5d6f: eb fe jmp 5d6f <c_4421+0x3>
5d71: 89 c8 mov eax,ecx
5d73: 83 c0 08 add eax,0x8

00005d76 <e_4468>:
>>
>>59180605
Well I guess we eliminated the possibility that it's optimized out.

I don't see why this wouldn't work then.
>>
>>59180528
Where is the rest of the sentence?
>>
>>59180694
I tried some different optimization levels.
O0 and O1 generate code that looks like it would work, but it segfaults.
O2 and O3 create the mov garbage with infinite loop.
>>
>>59180696
In your ass.
>>
P = NP
.מ.ש.ל
>>
>>59180694
I think I found it
00042180 <jw::dpmi::irq_config_flags jw::dpmi::operator|<jw::dpmi::irq_config_flags>(jw::dpmi::irq_config_flags, jw::dpmi::irq_config_flags)>:
42180: 83 ec 14 sub esp,0x14
42183: ff 74 24 1c push DWORD PTR [esp+0x1c]
42187: ff 74 24 1c push DWORD PTR [esp+0x1c]
4218b: e8 f0 ff ff ff call 42180 <jw::dpmi::irq_config_flags jw::dpmi::operator|<jw::dpmi::irq_config_flags>(jw::dpmi::irq_config_flags, jw::dpmi::irq_config_flags)>
42190: 83 c4 1c add esp,0x1c
42193: c3 ret

The operator | code is recursing somehow which causes a stack overflow with -O1. At -O2 it turns into the infinite loop. I don't see how though? (>>59180190)
>>
>>59177735
columns = 5
menu = ['Website', 'Username', 'Pasword', 'Email', 'Details',
'bee', 'ees', 'jay', 'pma', 'boy',
'ching', 'woo', 'wang', 'wang', 'wang',
'asdf', 'fdskfdf', 'adf', 'dks', 'k']
maxlen = max([len(opt) for opt in menu])
smenu = [opt.center(maxlen, ' ' ) for opt in menu]
offset= 0
for i in range(len(smenu) // columns):
print('| '+'| '.join(smenu[offset:offset+columns]) +' |')
offset+=columns
>>
>>59180908
Doesnt the second overload call the first and then the first keep executing itself at a | b in the cast?
>>
Can anyone tell me why these two lines aren't the same in Java?
if (line.substring(0, 2) == "//")
if (line.charAt(0) == '/' && line.charAt(1) == '/')

I want to use the top one because the bottom one looks retarded but the top one doesn't work properly.
>>
File: 1476206497974.png (37KB, 753x737px) Image search: [Google]
1476206497974.png
37KB, 753x737px
Beginnerlet here. what is generally regarded as more elegant/useful:

inputlist = ['doing1', 'doing2']
results = []
def fun(x):
x = x + 'some calculation'
results.append(x)

list(map(fun, inputlist))


or

inputlist = ['doing1', 'doing2']
def fun(x):
x = x + 'some calculation'
return x

results = list(map(fun, inputlist))
>>
>>59181038
dumb frogposter
>>
>>59181031
Google "java compare strings". First result.
>>
>>59181031
>==
>in Java
>>
>>59177823
> no mac
there is xamarin for mac now
>>
>>59181055
>>59181071
thx m8ys, 1st day at this
>>
Can I easily call haskell from rust?
>>
where should i look if i want to be able to reliably drag up cited documents in a textbook? ive got an inline citation with a surname, a general topic, and a year of publication to work with.
>>
>>59181038
the latter

>>59181107
https://mgattozzi.github.io/2016/10/15/rust-haskell.html
>>
>>59177823
>only with xamarin you can dev ios and android apps. no mac or linux
Well, this is simply wrong.

You can use C# to develop applications for pretty much any platform, including embedded devices.

>>59181093
It's not even limited to Xamarin; you can use Mono with GTK# or even WinForms on both Linux and Mac.

There are rumors of a fully cross-platform UWP-like GUI, however I wouldn't hold my breath on that.
>>
>>59181038
Absolutely retarded fucking frogposter
>>
>>59181147
>>59181052
I know I'm dumb, that's why I used dumb pepe
>>59181138
Thought so
>>
>>59180996
That's apparently what's happening here. I don't see any other way to implement it though. The custom operators are necessary here since ORing two enums together casts to int, and you can't assign an int to an enum for some silly reason.
I suppose I'd need to cast both to int first, then OR, then cast back to enum? This is completely absurd.
Also what strikes me as odd is how it's calling itself recursively with two identical variables (DWORD PTR [esp+0x1c]).
>>
>>59181038
>elegant/useful
>python
really now?
>>
>>59181130
nevermind, im retarded
>>
It seems like the x86 runs interrupt handlers for exceptions and software interrupts even when IF=0.
Does IF=0 only disable IRQ's?
>>
>>59181599
Also, it appears that it also reenables IF after the interrupt.
>>
I'm using vim and everytime I type ">>>" (without the quotes) I'd like it to be replaced by "->".

Is this possible?
>>
>>59181623
yes
>>
>>59181623
just type -> you autist
>>
>>59181640
how

>>59181648
no
>>
>>59181599
yes it's only for irqs. think about it, you can't just ignore exceptions by setting a flag. and software interrupts are part of normal execution flow.
>>
>>59181679
Alright, makes sense.
But, is it supposed to set IF to 1 after the interrupt even when IF was 0? that seems a little weird to me.

What if something disabled IRQ's temporarily (for interrupt-handler-safe mutual exclusion), but then a minor PF rudely comes in and enables them and fucks everything up?
>>
>>59181751
I don't think exceptions and software interrupts should touch the IF, no. what platform are you on?
>>
File: 1443647791169.gif (571KB, 512x288px) Image search: [Google]
1443647791169.gif
571KB, 512x288px
I have been receiving conflicting reports on the nature of Rust's relationship with POO. Can any Rust programmer answer this once and for all - is rust afflicted with the aforementioned disease?
>>
File: 1469324756048.jpg (65KB, 680x680px) Image search: [Google]
1469324756048.jpg
65KB, 680x680px
>>59181777
Oh wait dw. I'm a fucking baka.
It was because I was enabling interrupts somewhere in my printk code, which is called in my panic function in order to print the eflags..
>>
File: 1486594542834.jpg (12KB, 261x210px) Image search: [Google]
1486594542834.jpg
12KB, 261x210px
I can't into math, pls help.

I have values a which is always over 1.
I have values b which is always under 1.

c = a * b
c is then sorted in a list.

How do I make it so that b has exponentially more weight than a? Can't square it because it's always under 1.
>>
>>59181812
Looks like you're afflicted with a disease, pajeet.

Only filthy codemonkeys limit their knowledge and skill-set based on /g/ memes.
>>
File: ss+(2017-02-26+at+05.18.58).jpg (30KB, 361x272px) Image search: [Google]
ss+(2017-02-26+at+05.18.58).jpg
30KB, 361x272px
I'm done with Jumping Into C++, where do I go next?

Like, I feel like now I have a bunch of very basic blocks, but I'm missing the bridge between that and making "real" programs that aren't just little console apps.

Any book that teaches me more how to use C++, rather than teaching me C++ itself?
Maybe something about GUIs and making my program usable with buttons instead of cmd lines, or standard progamming practices, anything to take me out of the stalling point I've reached.

Like, that "Exercise table" that's posted sometimes has "Make a pong" clone as one of the examples for simple exercises, but I wouldn't know even where to start for that.

Hope I explained well enough what I'm looking for.
>>
>>59181947
square it
>>
>>59181947
Square root it.
>>
>>59181947
1/c?
Maybe plot
1/(a*b)
and see if that's sortof what you wanted?
>>
>>59181947
you take the reciprocal.

If b < 1 and a > 1 then a^-1 < b^-1
>>
>>59182055
https://learnopengl.com/#!Introduction
Consider if this is for you.
>>
>>59181988
>Looks like you're afflicted with a disease
If having non-shit taste is a disease, then sure.
>pajeet
Is that what you POO guys call each other now? I'm not your friend though so don't address me like that.
>Only filthy codemonkeys
True, POO monkeys are indeed filthy.
>limit their knowledge and skill-set
Are you implying there is some kind of special knowledge required to write blatantly shit code? Literally anyone can do it.
>/g/ memes
Learn the definitions of words before you use them, you moronic redditor.
>>
>>59182173

I have a friend who works for Konami who posts funny stuff involving his hellscape nightmare of working with OpenGL every day

Is he just exagerating for humor, or is it really frustrating to work with?
>>
>>59182195
Are you the guy who thinks that C structs are OOP objects?
>>
>>59182238
Watch the recent video by Jonathan Blow where he complains about OpenGL non-stop. Mostly the absolute lack of developer feedback (Something not looking like you expected it to? It certainly won't tell you why) compare to the alternatives (Direct3D and Vulkan).
>>
>>59182338
No, redditor, I'm not that guy. As you might have noticed we don't exactly have names on this website. I know it's hard to adjust with that illness of yours, but could you at least try?
>>
>>59182358
I'm not even the same person (but you noticed yourself that there are no names here). Why are you so angry? Did you forget to take your pills?
>>
>>59182358
>As you might have noticed we don't exactly have names on this website.
Maybe that's exactly why he asked you fucking autist.
>>
>>59177863
>exceptions
The cancer that killed OOP and forced RAII onto people.
>>
>>59182414
>Why are you so angry?
Why would I not be angry? I was talking to someone who denies basic and self-evident truths.
>Did you forget to take your pills?
Why the fuck does everyone keep asking this all the time? I don't take any pills.
>>59182495
And what would the point of my answer be exactly if there is literally no way to tell if I'm lying? Would he just believe me? Doubt it.
>>
>>59182519
>Why would I not be angry? I was talking to someone who denies basic and self-evident truths.
Still no reason to be an asshole to someone else.
>>
>>59182519
>Why the fuck does everyone keep asking this all the time
JEJ
>>
>>59182540
If someone acts like an animal, I will treat him as such.
>>
>>59182353
>Mostly the absolute lack of developer feedback
>Something not looking like you expected it to? It certainly won't tell you why
OpenGL does what you tell it to, read the manual. if the relevant (and readily available) error checks come back clean then either you fucked up or your GPU manufacturer fucked up implementing the spec (this happens way too much). one of those is your own fault and there's nothing Khronos can do about the other. the global state is a disaster though, i'll give you that. Direct3D and Vulkan are definitely better but it's not like OpenGL is particularly hard to deal with if you know what you're doing
>>
>>59182563
Asking whether you are a certain person is acting like an animal? Then what are you? Dirt?
>>
>>59177800
>C#
No.
>>
>>59182574
By "developer feedback" I meant "feedback TO the developer". As in "WHAT exactly went wrong and why".
Which the alternatives do. Even if it's the driver manufacturer's fault.
>>
>>59177869
really? Do you have any source to back it up? Should I give up on mozart?
>>
>>59182580
I literally couldn't read this, I tried. Are you saying that I can't tell whether or not a "person" is acting like an animal? It's pretty obvious when you look it.
>Then what are you?
Just a regular human.
>>
>>59182599
>I meant "feedback TO the developer"
i know. i'm just saying i haven't had many problems with this because i use the status/error functions and check capabilities. it's far from perfect but they did what they could given they didn't have the luxury of being able to break interface compatibility every few years like Microsoft. manufacturers barely fucking try with their spec as it is. at least Vulkan will finally bring that to an end
>>
>>59182519
>well-documented phenomenon
>>
>>59182773
Is this a new meme?
>>
File: 46-1.jpg (137KB, 561x421px) Image search: [Google]
46-1.jpg
137KB, 561x421px
>>59177055
>brainlet--
>>
File: 1460426540179.png (250KB, 493x500px) Image search: [Google]
1460426540179.png
250KB, 493x500px
>>59182839
You are cancer itself. No wonder you like C""""++"""" -- it's in the name. Twice even.
>>
>>59179105
he means

this shit

spaces between every sentence

which of course can only mean you browse reddit, and can be used in no other circumstance for any reason

faggot
>>
>>59182892
Dumb animuposter.
>>
>>59182892
You have a containment board.
>>>/toy/
And I'm being charitable considering you're over 18.
>>
>>59182927
>Yes I shit on streets so what?
I'm sorry, but you must be confused, redditor. This is an anime website. You should leave know.
>>
>>59182948
I don't like playing with toys. Stopped doing that shit a long time ago.
>>
>>59182927
Please return to >>>/r/ibbit where you and your friends belong.
>>
File: imblying.png (6KB, 890x47px) Image search: [Google]
imblying.png
6KB, 890x47px
hmm
hmmmm
hmmmmmmm
really activates the grey matter
>>
>>59183006
I sexually identify as an attack helicopter and feel offended by this.
Fucking patriarchy!
>>
>>59182839
>brainlet
back to >>>/sci/
>>
Writing a lexer in Java, using regex.

How does one define Strings.
STRING("[\"].*[\"]")


That's incorrect, appearantly.
>>
>>59183107
>lexer
>using regex

shit nigger
>>
>>59183107
Why limit yourself to regular languages?
>>
>>59182642
>muh mental illness
fuck off, toddler
>>
Just using it for lexing/tokenizing, it's quick and get's the job done fairly well.
>>
>>59183173
>muh
How does it feel being a double-digit? Does it hurt?
>>
>>59183177
Until you want to use a CFG.
>>
>>59183182
desu my phone number has 7 digits like anyone else
>>
>>59183182
>buku desa
>>
>>59183224
The grammar is context free, regex is simply used for returning a list of tokens.

" 1 + 1" -> [NUM 1, BinaryOP +, NUM 1].

I just need a way to define the string datatype in regex.
>>
>>59183227
what kind of stupid question is this?
>>59183240
Ok, sure.
>>
>>59183279
What kind of stupid question is this? My original statement was not a question.
>>
File: 1460028302170.png (164KB, 319x354px) Image search: [Google]
1460028302170.png
164KB, 319x354px
>>59183303
Do you see a question mark at the end of my sentence? You should just abandon this thread, your retardation is showing.
>>
>>59183317
>muh animoo mental illness
>>
>>59183269
[^"]*
>>
>>59183317
>Do you see a question mark at the end of my sentence?
Yes, I do
>You should just abandon this thread, your retardation is showing.
You first m'autist
>>
>>59183342
\"
>>
File: 1479140203240.jpg (15KB, 245x255px) Image search: [Google]
1479140203240.jpg
15KB, 245x255px
>>59183334
Get the fuck out of here, you shit-eating moron.
>>59183365
>Yes, I do
That's literally not even a valid response to what I just posted.
>You first m'autist
That's not a question.
>>
>>59183406
I can't even keep the track of who is trolling who anymore
>>
>>59183224
>>59183159
>>59183147
>/g/ doesn't know what a lexer is.
>>
>>59183406
you don't have to try so hard anon, i bet you're a decent guy, just be yourself
>>
>>59183406
>hurr durr animoooorr
do you at least take pills?
>>
File: 1478756493135.gif (704KB, 600x337px) Image search: [Google]
1478756493135.gif
704KB, 600x337px
>>59183433
Don't be fucking naive.
>>59183449
I'm not sure I understand what you're getting at here.
>>59183466
Can you repeat the question?
>>
>>59183480
>animooooooooo
shyggy
>>
>>59183480
I mean all this trying to be smug and condescending, you're compensating for nothing, im sure you are likable without putting on acts, you dont have to look cool to us anon
>>
File: Capture.png (47KB, 1379x143px) Image search: [Google]
Capture.png
47KB, 1379x143px
I'm building a frequency shiftkey decoder for a project of mine, but it aint working. I gotta decode pic related, any ideas?
>>
I need motivation to start a new programing project, give me something anonq
>>
>>59183510
yes
>>
>>59183514
rpg active combat system
>>
File: 1484069669661.png (549KB, 1920x1080px) Image search: [Google]
1484069669661.png
549KB, 1920x1080px
>>59183514
Motivation or idea?
>>
File: 1414439317157.jpg (161KB, 1920x1080px) Image search: [Google]
1414439317157.jpg
161KB, 1920x1080px
>>59183502
It was never an argument, dude.
>>59183503
How the fuck can anyone actually be this brain dead?
>>
>>59183560
both
>>
>>59183562
>out of meds
>animoo retardation tho
>>
>>59183560
>Design a Game Engine in Unity
lol wut
>>
>>59183588
What meds? What would you recommend?
>>
>>59183447
apparently neither do you
>>
>>59183699
he is /g/, so yes, that's included in the definition.
>>
File: Xamarin.png (63KB, 1180x600px) Image search: [Google]
Xamarin.png
63KB, 1180x600px
Perfect IDEs do not exis-
>>
File: 1481460001803.jpg (72KB, 960x656px) Image search: [Google]
1481460001803.jpg
72KB, 960x656px
>>59183731
what teh fug is this disgusting shit?
>>
>>59183731
They're adapting Xamarin Studio into a Mac release of Visual Studio:
https://www.visualstudio.com/vs/visual-studio-mac/
>>
>>59183731
Netbeans is the perfect IDE
>>
>>59183782
THIS!
>>
>>59183731
Integrated Drive Electronics cables had shit data rate compared to
>>
>>59183514
Make a program that computes the number of penises you sucked this week
>>
>>59183932
#include <stdio.h>
#include <limits.h>

int main(int arg, char** argv) {
printf("%d\n", UINT_MAX);
return 0;
}
>>
>>59183970
>unsigned
>%d
>>
>>59183932
>inb4 integer overflow
>>
>>59183970
-1
>>
>>59183992
So you've sucked one inverted penis thus far?
>>
I'm working with both Linux (Manjaro) and Windows (10). I'm designing software to split scanned images of documents into individual characters.

input.png -> algorithm -> out_n.pgm
n = 0..numChars on page


Why is performance shit on Windows? The exact same .cpp file, the only difference is "stdafx.h" is not included on Linux. gcc on Linux, VS2015 on Windows.

>input is 132mb .pgm (converted from .png from IM) containing 165 characters
>Linux performance
>44 seconds, 27 seconds with -O2 flag
>Windows performance
>a whopping 480 seconds
>>
>>59183983
>>59183992
i-it was done on purpose g-guys
>>
my code is segfaulting
somewhere deep within the bowels of std::vector
it happens only during an interrupt
and I have no idea where to start looking
>>
>>59184005
I'd see it a receiving a bj desu
>>
>>59184019
windows is shit, who knew
>>
>>59183562
>How the fuck can anyone actually be this brain dead?
I dont know, I'm glad you're becoming self aware though.
>>
alright guys lets program something together

we can all use different languages and cross compile them together
>>
>>59184035
I'd see it as he got some docking done.
>>
Hey mongoloids, Microsoft has fixed C.
Behold: https://github.com/Microsoft/checkedc

With this, the shitposting cretins have no remaining arguments against the once and future king of all languages. Better luck next time fuccbois
>>
>>59184077
so you want us to create a steaming pile of shit?
>>
>>59184101
Nigga, the latest C11 standard defined safe input, string and memory handling functions. Problem is: no compiler or libc has implemented them yet. Reason: it's not the effort because it's a dying language anyway - no new C code is being written, and existing C code is being actively replaced by modern languages.
>>
Would you guys rather program in php or pick up random women at random places?
>>
>>59184101
>>59184142
worth the effort*
>>
File: anal beads.png (3KB, 85x125px) Image search: [Google]
anal beads.png
3KB, 85x125px
>>59183932
>Make a program that computes the number of penises you sucked this week

Enum.GetValues(typeof(DayOfWeek)).OfType<dynamic>().ToList().ForEach(WriteLine);
>>
>>59184166
In hindsight, I forgot how to read and understand English.

In my mind, I was thinking
>List every day of the week that you suck penises.
>>
>>59184142
>no new C code is being written, and existing C code is being actively replaced by modern languages
prove it

also nobody uses c11, for the same reasons nobody uses the 'modern language' alternatives you refer to
>>
File: 1487608084850.jpg (53KB, 312x312px) Image search: [Google]
1487608084850.jpg
53KB, 312x312px
>>59184166
>
OfType<dynamic>()
>>
>>59184281
Don't assume my types, shitlord.
>>
>>59184272

>prove it
You're asking me to prove a negative.

>nobody uses c11, for the same reasons nobody uses the 'modern language' alternatives you refer to
Nobody uses C11 because after 6 years no one has properly implemented it.

>nobody uses the 'modern language' alternatives you refer to
Prove it.
>>
the size of newly initialized vectors in c++ starts at 0 right?
>>
>>59184347
No it starts at 1 - 0.99...
>>
>>59184166
in haskell this is just

mapM_ print [minBound :: DayOfWeek .. maxBound]
>>
I wanna program something neat in C. I have been doing JS for my job lately and want to return to being a purist
>>
>>59184398
how about you program deez nuts
>>
>>59184398
>C
>pure
>>
>>59184536
tell me what is pure
>>
>>59184371
In lisp this is just
(mapcar 'print days-of-week)
>>
>>59184547
There isn't a single useful pure programming language.
>>
>>59184569
ok i guess i will stop using computers now
bye
>>
How much of a faggot am I for using not instead of ! in sepples? I think it is more readable and harder to miss.
>>
>>59184547
Languages generated by regular gramamrs
>>
>>59184027
what if you always thought
ss == ds
that's gcc right now
guess what
>it's wrong.
>>
>>59184556
>days-of-week

Yeah, in haskell this is just

mapM_ print daysOfWeek
>>
guys, what's a reasonable stack size for interrupts?
>>
File: Screenshot_2017-03-01_20-12-07.png (135KB, 585x590px) Image search: [Google]
Screenshot_2017-03-01_20-12-07.png
135KB, 585x590px
What other basic features does a media tagger need?
>>
I'm just starting to learn how to program and I was wondering if you guys could answer what may be a noob question:

What is 2GFY? I tried googling it and the only results I got were about protein chains.
>>
>>59184770
Someone told you to "Go Fuck Yourself"
>>
File: ehewhatlu.png (42KB, 169x169px) Image search: [Google]
ehewhatlu.png
42KB, 169x169px
how the fuck do you do things like this in a clean way without having to check whether something is unset for the first iteration every iteration?
closest = None
for i,coordinate in enumerate(coord_list):
distance = calculate_dist(base,coord)
if not closest:
closest = i,distance
elif distance < closest[1]:
closest = i,distance
print('Closest', coord_list[i])
>>
>>59184860
...Well I feel fucking stupid. But are you sure it can't mean anything else? Cause the context I heard "2GFY" was when I was asking a Chinese programmer (who doesn't speak English well) whether she thought learning programming was useful.
>>
>>59184928
The only thing I can think of is setting distance to
-1,float('inf')

the first iteration
>>
New thread:
>>59184963
>>59184963
>>59184963
>>
New thread:

>>59184960
>>59184960
>>59184960
>>
>>59184928
By not writing it in Python.
>>
>>59184965
>>59184970
Fucking nailed it dudes
>>
>>59184970
This thread was posted first.

>>59184965
This thread was linked first.

doushio kana
>>
Can anyone explain me this syntax

for i in range(1, 100):
if not any((i-a in set_1) for a in set_1):
>>
>>59185374
Posted early in mistake.

I tried something like
for i in range (1,100):
for a in set_1:
if not any(i-a in set_1):


But it seems like the result is completely different. I don't really understand that thing inside the any().
Thread posts: 318
Thread images: 30


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