[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 | Voyeur Cams | Click for more| Home]

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.
Voyeur Cams

Thread replies: 308
Thread images: 34

File: pair_programming.png (198KB, 640x480px) Image search: [iqdb] [SauceNao] [Google]
pair_programming.png
198KB, 640x480px
This is /dpt/, the best subreddit of /g/

Pair programming edition

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

Filesharing and chat: https://volafile.io/r/kUFzLJ

code of conduct:
no racism
no insult
no sexual harassment
no gender discrimination

wat r u working on, anon-chan ?
>>
Go fuck yourself, redditfag.
>>
2nd for Go

>>51500931
muh sekrit klub
>>
>>51500959
If you seriously believe what is in the OP to be acceptable, you should fucking kill yourself.
>>
>wat r u working on, anon-chan ?
Trying to actually flesh out a specification for my language so that I can actually start implementing it finally. Not even done describing the basic syntax yet and I've been at it for ~2 hours now.
>>
File: 1441439560294.jpg (80KB, 500x500px) Image search: [iqdb] [SauceNao] [Google]
1441439560294.jpg
80KB, 500x500px
is it ok if i just use c++ as c with proper strings instead of bothering with all the oop shit
>>
>>51500924
>no link to old thread
Come on.
>>
>>51501338
Shit like that isn't going to make people want to use your thread, despite how shitty this one is.
>>
File: d.jpg (638KB, 2000x1516px) Image search: [iqdb] [SauceNao] [Google]
d.jpg
638KB, 2000x1516px
>>
File: 1448263215242.jpg (63KB, 600x338px) Image search: [iqdb] [SauceNao] [Google]
1448263215242.jpg
63KB, 600x338px
How do I move past making shitty command line calculators in C?
I want to write something actually useful.
>>
how to learn arm assembly?
>>
>>51501405
Decide on something doable to make.
Make it.

Maybe implement an RFC or something. Network programming is fun.
>>
>>51501405
Find something that interests you and then research the shit out of it. Along the way try to learn any new skills (programming in general, libraries, languages) and you'll figure out how to do what you want. Once you've got that down you can learn anything else in the same way (although with less work the second time, etc.)
>>
Thank you for including a code of conduct.
>>
>>51499595
>>51500002
Send help
Also call him a shitter
>>
File: Hidamari_DPT_3.jpg (263KB, 809x654px) Image search: [iqdb] [SauceNao] [Google]
Hidamari_DPT_3.jpg
263KB, 809x654px
>>51501405
You are forever doomed to writing a gui frontend to those commandline programs, or reinventing something that has already been done.

If you want a project that will take six months plus, write media player frontend for mpv.
>>
File: squid lmao.jpg (147KB, 796x900px) Image search: [iqdb] [SauceNao] [Google]
squid lmao.jpg
147KB, 796x900px
#define squid 1
#define kid 0
void squid(void)
{
int you = kid;
while (1)
{
if (kid)
you = squid;
else if (squid)
you = kid;
}
}
>>
>>51501405
something useful ? in C ? lel, maybe a FOSS implementation of powershell for unix.
>>
>>51501424
This. Networking = money. Work on a cloud team can confirm
>>
File: DeDeDesgusting.png (633KB, 600x450px) Image search: [iqdb] [SauceNao] [Google]
DeDeDesgusting.png
633KB, 600x450px
>>51501483
>int
>>
File: 1412011173618.png (418KB, 480x650px) Image search: [iqdb] [SauceNao] [Google]
1412011173618.png
418KB, 480x650px
>>51501487
>I can't write non-trivial programs in C, so nobody else can either
>>
>>51501501
We'll use your thread next time bro :)
>>
>>51501501
Give up.
>>
Hey /dpt/.

I know C and can do graphics and interactive stuff with SDL fairly well. What are some good project ideas?

I also only know C (some C++ but that doesn't matter.). What language should I learn next that isn't Haskell or a Lisp? Something employable, but not Java. Python?
>>
>>51501518
Java, you'll have to learn it anyway
>>
>>51501518
>What are some good project ideas?
That involve graphics and stuff?
I simple 2D game engine is the first thing that comes to mind.

>What language should I learn next that isn't Haskell or a Lisp?
>Something employable
Lua. Lua is enjoyable as fuck.
You get to mess with tables and shit.
>>
>>51501530
Right, and I will, but I want to spend my free-time learning something that I'll use outside of the place (class) that I have to learn it for.

>>51501537
That's the current project and it's just about done, hence looking for a new one. No, don't ask to see it, it's not impressive or even good for that matter.

I've looked at Lua, but I can't see myself using it ever. Thanks though.
>>
>>51501405
Do you have any problems, or things that take annoyingly long? Have you noticed any bugs in open source software you use?

A great exercise that is demonstrates a lot of useful stuff is a LAN chat program.

You can start simple (basic chat over TCP) and add async networking and UI, group chat and various models for implementing it, zeroconf service discovery (see: Avahi, DNS-SD), NAT traversal + peer-to-peer over the internet, authentication+encryption, etc.
>>
Why does this result in a stack overflow?
public class Parent {

public Child child = new Child();

public static void main (String[] args) {
Parent p = new Parent();
}

}

class Child extends Parent {
}
>>
>>51501608
>public Child child = new Child();
Just think about that line for a moment.
>>
>>51501447
They've given him plenty of help. The most he can hope for is a quick briefin without relegating the whole thing to demonstrations of code that he will just pick apart and use without learning. He's being a bit too manipulative about it. Just let him use what he has now and ask more specific questions later. You can't force someone to learn unless they want to.
>>
>>51501608
Dont' think too hard, though. You might give yourself a hernia.
>>
>>51501608
> public Child child = new Child();

why
>>
>>51501608
Haha.

Here's why:
>public class Parent {
>public Child child = new Child();
>class Child extends Parent {
>>
>>51501615
>>51501626
>>51501640
>>51501669
No need to be so fucking snarky about it. Dumb fucks. "Thanks"
>>
>>51501608
The code isn't necessarily run using the code you have created.
So when you make Parent, Child doesn't yet exist. If my understanding is correct, that then means that when you execute the program and all actions and events are passed to the stack, your Child class extends the Parent class, as it should, in the stack and "pushes" the rest of the memory off of the stack. Since the programs use references when pointing to objects, the allocation process is very much involved in the specification of the class. If you place a Child class in the Parent declaration, then the data hemorrages beyond it's allocation.
>>
>>51501680
It was funny because it was such a small example.
>>
>>51501680
You'll learn a lot more if you get to the answer yourself. Dumb fuck.
>>
>>51501680
They were hints and clues you louse. The Child class pops out of the memory for the Parent class. Kind of like a hernia does when it begins to pop out of the belly.
>>
>he doesn't write pythonic code
>>
>>51501767
A man can dream.
>>
My GitHub only has C projects.
What language should I do something in to look employable?
I want to get into simulations I think
>>
>>51501912
Statistically, Java, C++, or C#.
>>
Why Not Check the Adresses in the registrys
>>
>>51501960
Damn it man. Alright. Thanks.
>>
>>51500924
I'm stuck, /g/. Here is what I want to do (assume I have include-guards):
/** @file A.hpp */
class A
{
/* standard class definition */
};

/** @file B.hpp */
#include "A.hpp"
class B
{
class A;
/* standard class definition */
};

/** @file B.cpp */
#include "B.hpp"
/* ... */
void B::BMember()
{
A a(6);
}
/* ... */

To summarize, I have a class (A) which I want to be only accessible by another class (B). However, I don't want to define class A within class B, I want to give it its own header and implementation file.
But what I have above doesn't work for me; I get a "variable a has initializer but incomplete type".
How do I fix this?
>>
>>51502018
Make the "class A" inside class B a pointer (or reference or whatever the fuck meme++ uses).
>>
>>51502053
No, that isn't want I want.
I don't want a pointer/instance of A within class B, I want class A's declaration in class B and it's definition in another file.
>>
>>51502081
lol
>>
>>51502081
There is no way around it. All engines are written this way but with references or smart pointers (unless its a really shitty engine that doesn't care about compile time).

Either make Class A inline or deal with it.
>>
>>51502081
a.hpp
#ifndef A_HPP
#define A_HPP

class a {
int a;
};

#endif

b.hpp
#ifndef B_HPP
#define B_HPP

class b {
#include "a.hpp"

int b;
};

#endif
>>
>>51502110
See, that's the thing. I could have sworn that I did this when I wrote a binary search tree last year. I had the bst Node declared in the bst class, then defined in another file.
>>
>>51502137
Sounds like you want an abstract class.
>>
>>51502133
this is /g/?

>>51502164
No, I don't. How does an abstract class even apply here?

Christ guys, I think I'll just take >>51502110's advice and leave
>>
>>51502137
Dood i figured it out bro, cant believe i didnt see it sooner.

class A; in class B is a actually A::B not B.
and A::B is never declared.

so if you remove that your code will work.

You only need to do the pointer stuff of you dont want to include the header to a class by doing a predeclaration of it, making a pointer, and including the headers in the cpp files (off topic).
>>
>>51502185
My post was satire, you dumb fuck.
Also, you're not entitled to an answer. This place would be a much better place without you.
>>
>>51500924

I'm getting into C from Python,

is this a good start?

http://aelinik.free.fr/c/
>>
>>51502018
Do you have #include "B.hpp" inside A.hpp?
>>
>>51501323
At one point using oop will just be easier than only functions and structures
>>
>>51502209
>Teach yourself X in Y hours
It's shit.
>>
>>51501765
>>51501765
Make a program that takes an Object and describes it as something more.
Each person would order the different things the programmer needs to do.
Things like;
What does it need to know in order to be able to extend its functionality on the fly?;
What does it need in order to be able to achieve functionality/accomplish the degree of functionality described?;
What action does this set of processes describe?;
What kind of "thing" commits to this sort of action/behavior set?;
How many different ways can this "thing" describe the actions/behaviors?;
To what can this thing describe those behaviors;
When can this program commit to these behaviors and communicate effectively without compromising the rest of the data?;
What are the contextual conditions for this program to work?;
How can this program be ported over to other contexts?;
How can you define a system to hold these conditions in place?;
Who gets credit for what?;

I think that could help. Don't forget to use this to help other people in the future. I am having trouble getting hired because people are too into the whole "he doesn't say it like I like to hear it" deal.
>>
>>51502018
Have you tried making the class variable protected?
>>
>>51502225
What book do you recommend for picking up C?
>>
>>51502311
If you already know how to program: K&R, then maybe spend a few hours learning what was introduced in C99 and C11.
>>
File: thanks g.jpg (8KB, 150x149px) Image search: [iqdb] [SauceNao] [Google]
thanks g.jpg
8KB, 150x149px
Hey /g/, trying to think of a more optimal way to solve this C/C++ problem.

Let's say a user can input commands in the form of strings for example "help" or "find yellow".

Right now I have a big if else block of all the possible commands (which are stored in an array) and if it finds a match, execute the proper function help() or find( color ), this seems tedious and inelegant.

What I'd like to do is have an array of commands and if the users input matches (or contains) an array element then do arrayelement( arguments ); This would be possible with eval but C++ doesn't have an eval that I know of.

Any tips or am I shit out of luck?
>>
>>51502323
map
http://www.cplusplus.com/reference/map/map/operator%5B%5D/
>>
>>51502246
Thanks senpai
>>
File: 1376813888542.jpg (33KB, 285x281px) Image search: [iqdb] [SauceNao] [Google]
1376813888542.jpg
33KB, 285x281px
>>51502323
>C/C++
>Grouping two completely different things together

Anyway, just make an array of strings paired with commands and then loop through testing each string. Or you could use a hashmap.
>>
>>51502407
>>51502358

Thanks brehs, that's kind of what I was thinking, I just wanted to be lazy and use eval instead of having a second array/hashmap of std::functions or pointers to functions.
>>
File: 1448352752790.png (14KB, 548x470px) Image search: [iqdb] [SauceNao] [Google]
1448352752790.png
14KB, 548x470px
Dude from >>51501447 here, got some test code that's spitting out an error. Any idea why?
>>
>>51502323
Make an array that holds all the commands as numeric values, ( atoi(string) ) and then order them from largest to smallest, Loop over the array and if the search key is less than the element, it continues searching until it finds the correct command or returns an error.

You can do this recursively too if you want to save on memory ( like when you need to do it as an embedded process rather than a purely software based one ). The recursive process could be done using an explicit list of the commands or with a logical annotation of those same process as stated above. I figure you want to give the user as many options as possible considering you mentioned contains().
>>
I'm getting this exception:

Exception in thread "main" java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(Unknown Source)
at java.util.LinkedList$ListItr.next(Unknown Source)
at fenn20.CarLists.main(CarLists.java:46)


    public static void main(String[] args) {
ArrayList <Car> cararray1 = new ArrayList <Car>();
cararray1.add(new Car("Toyota", "Corolla", 10000));
cararray1.add(new Car("Honda", "Civic", 5000));
cararray1.add(new Car("Honda", "Accord", 12500));
cararray1.add(new Car("Mitsubishi", "Outlander", 20000));
cararray1.add(new Car("Mitsubishi", "Lancer", 15000));
cararray1.add(new Car("Toyota", "Camry", 7500));

for (int i = 0; i < cararray1.size(); i++) {
System.out.println(cararray1.get(i));
}
System.out.println();
System.out.println("Most Expensive Car: " + Collections.max(cararray1, new CarComparator()));

LinkedList<Car> cararray2 = new LinkedList <Car>(cararray1);
cararray2.add(4, new Car("Hyundai", "Elantra", 3000));
System.out.println("Added New Car: " + cararray2.get(4));

Collections.sort(cararray2, new CarComparator());

System.out.println();
ListIterator<Car> lit = cararray2.listIterator();
System.out.println("In Increasing Order:");
while(lit.hasNext()){
System.out.println(lit.next());
}
System.out.println();

System.out.println("Removed First Car: " + cararray2.get(0));
cararray2.remove(0);
System.out.println("Removed Last Car: " + cararray2.get(5));
cararray2.remove(5);

System.out.println();
System.out.println("In Decreasing Order:");
while(lit.hasPrevious()){
System.out.println(lit.previous());
}
}
}


Line 46 is this:

System.out.println(lit.previous());
>>
>>51502439
move() isn't a member of Player. Move the second curly brace to the end of the second viewport.

class Player
{
float
float
float

Player( ..., ... ){}
move(){}
display(){}

} <------ like this
>>
>>51502358
oh sorry for being pretty vauge.

how I would do it is by:
make a map of a string (duh), and a function with a string parameter (preferably using <funtional>).

So you getline the string.
get the first word by doing
std::string name(str.begin(), str.begin() + str.find_first_of(" "))[\code]

then do above again but get the last part of the string and plug that in the parameter of the string.

Then in your functions, use the rest of the string or if its not expected throw an exception.
>>
>>51502464
We need to see your Car class declaration
>>
>>51502323

Use a goddamn hash table. Something like std::unordered_map, or google dense hash map, or khash.

Jesus fuck, haven't you ever taken a data structures course before?

Also, using eval in any language is like asking for a million security holes to open up in your program. Eval = evil.
>>
learning MATLAB for this DSP class

why is every fucking tutorial by Indians

example: http://www.mathworks.com/solutions/dsp/
>>
>>51502534
Because only curryniggers make video tutorials.
>>
>>51502501

Can we just make it a rule where if you want to receive help, you have to post the entirety of your source code? Can we just add that to the start of new threads?
>>
>have a bunch of JButtons in a panel (stored button array)
>ActionPerformed is in panel
>if I press one button all buttons except that one do something
How do I do this? Basically want

if(buttons(i) is pressed)
doButtonAction for buttons(j != i)
>>
>>51502522
Im gonna have to disagree with unordered_maps.
They are only ok if you are doing many, many insertions and lookups but in small maps, the insertion time between them are insignificant, and and maps are faster in most situations.
>>
>>51502559
I stopped posting in headphone general when people started being autistic about following the OP pasta.
It doesn't even matter in most cases because most people would be well served with an MDR-7506 and they have no reason to get anything else.

People ITT should have a sense to share all their relevant code if they expect homework help.
>>
>>51502522
but I do have to agree that they are significantly faster for find() (which is what anon is gonna have to use), but in terms of readbility, and the scale of his project the usage of unordered_maps is unnecessary.
>>
>>51502534
you don't know hell until you take a class in optimization
>>
>>51502189
Removing the "class A;" bit makes the code work, yeah, but keep in mind that I want class A inaccessible/invisible to everyone except for class B.

In any case, I figured it out.
>>
File: 1446054096900.jpg (132KB, 738x738px) Image search: [iqdb] [SauceNao] [Google]
1446054096900.jpg
132KB, 738x738px
>>51502522

I have taken a data structures course before. I was aware of the hash map solution, I was seeing if there was something cleverer. I am aware of evals pitfalls. That doesn't mean it should never be used. Same with gotos and globals.

Why is your inflection so hostile friendo, especially because I never claimed to be good at programming either.
>>
>>51502563
nvm somehow managed to scroll past getSource every time i checked the api
>>
File: just.png (89KB, 167x252px) Image search: [iqdb] [SauceNao] [Google]
just.png
89KB, 167x252px
Has anyone here ever used LabVIEW

This is like hell incarnate
>>
>>51502564

Hence why I gave other options, such as khash and google dense hash map. Also, your graph seems to suggest that unordered_maps are better for smaller hash tables.

>>51502607

One can never tell how many elements he may end up using as his project expands. Use of a hash table isn't a bad idea.
>>
>>51500924
>code of conduct:
>no racism
>no insult
>no sexual harassment
>no gender discrimination
FUCK OFF NIGGER FAGGOT
>>
>>51500924
>tfw you will never pair program in haskell with your qt trap programmer bf
>>
>>51500924
what anime senpai?
>>
>>51502718
boku no pico
>>
>>51502684
but perhaps anon wants to have a command that lists commands, and perhaps he wants it in order
:^)
>>
>>51501509
Except when you use multiprogramming (working with processes)
>>
>>51502638

Goto has a limited, but acceptable use case.
Globals are always usable, but discouraged wherever they are unnecessary.
Eval is almost never acceptable unless arbitrary code execution is the point of the program (i.e. REPLs, reverse shells). Otherwise, any solution to a problem that involves eval may as well be considered a security hole in its own right.

Also, I may act like an asshole, but that is only because I want you to become a better programmer. You should see negative criticism as a form of encouragement to improve yourself.

>>51502715

Having spoken with a few traps, I have to say that many traps tend to be insecure about the fact that they have a penis. The fact that you want a "trap bf" may scare them off.
>>
>>51502715
Hey, I've made a drawing with that Z in it before. How cool.
>>
>>51502757
What are you on? For any large-scale project or product, globals should NEVER be used.
>>
>>51502757
>have to say that many traps tend to be insecure about the fact that they have a penis. The fact that you want a "trap bf" may scare them off.

those weren't traps
those were transsexuals
>>
>>51502209
c primer plus
>>
File: 1444000691461.png (699KB, 970x725px) Image search: [iqdb] [SauceNao] [Google]
1444000691461.png
699KB, 970x725px
>>51502072
Ruby, i noticed you were insulting me because I was expected to traverse a fucking integer that was clearly not an array of integers.

Fuck you.
>>
>>51502789

Keeping all variables local is not a one size fits all approach. Though global variables should be avoided where possible, you cannot avoid them completely, especially when concurrency gets involved, and resource sharing is a part of requirements.
>>
>>51502864
You can still use it as integers by using the array index. Or by parsing the string as an integer, but then you'd have to have a hash or sub-index. Or by some stroke of luck, find that the language has already done it for you. Let's hope you're not so lucky. :p
>>
>>51502864

I was insulting the video creator for not reading the fucking problem description and stumbling over a problem that is as easy as Fizzbuzz. If you are the video creator, then I guess you're a fucking idiot. Congratulations.
>>
>>51502895
at least i'm employed and you're not
>>
>>51502789
Sounds like you mean for enterprise level programs and for the sake of security. In that case you can always subsidize the cost of reaching the target variable through the use of a common denominator. It would certainly help simplify the entirety of the program through commodification. Think Pi.
>>
>>51502908
yes, and?...
>>
>>51502877
Even with concurrency, they are avoidable.
Granted, this introduces a few other hurdles, but a good programmer can leap them.
>>
File: 1359784618469.gif (363KB, 500x500px) Image search: [iqdb] [SauceNao] [Google]
1359784618469.gif
363KB, 500x500px
>>51502908
>>
Is there a better way to determine if a number is prime?
int isPrime(unsigned num)
{
unsigned sq = sqrt(num);
if (num < 2)
return 0;
unsigned i;
for (i = 2; i < sq; i++)
{
if (num % i == 0 && i != num)
return 0;
}
return 1;
}
>>
>>51502908

Well, actually I am employed. I've got a work study position helping a professor write his papers. Granted, it's not related to programming, but it does help me develop a skill that I'm going to need towards the end of my master's degree, since part of the requirements of the program is that I get a paper published in a reputable computer science journal.

And on top of that, I've got a research assistantship next quarter (should have started this quarter, but the professor had visa issues) which does involve programming. And in specific, it's going to involve some VxWorks kernel programming. So that'll be fun.

Anyways, I'd love to stay and chat, but I have to be up in 6 hours.

Zai Jian!
>>
>>51502983
Yes.
>>
>>51502983
>int isPrime
Use bool (_Bool)
>unsigned i;
You've been able to declare a variable in the for loop for 16 years.
>i = 2
>i++
Checking even numbers (besides 2) is completely pointless. None of them will EVER be prime.
>i != num
That's a pointless check that will never be true.

Is there a better way to determine if a number is prime?
Sieve of Eratosthenes may be more appropriate if you're testing a lot of primes. You could even take the lookup-table approach if you know the upper limit of the primes you need and it's not too big.
>>
>>51502983

Sieve of Eratosthenes if testing multiple numbers

Miller Rabin if 100% accuracy is not required (this is what is used in many encryption standards, because sqrt(HUGE_PRIME) is still fucking huge).

Otherwise, fuck if I know.
>>
>>51501487
>FOSS implementation of powershell for unix.
We already have every single shell ever, all of which miles better than anything Microsoft has ever made.
>>
>>51502564
>retrieving value from a map with one element
>THREE HUNDRED MILLISECONDS
>>
>>51503176
I guess if that's the case you could always extend the class and override the functions to account for the number elements. Like a matter of quantization or by catergory,
>>
>>51503388
Well, no, either that anon is doing something terribly wrong, or he's doing thousands of map lookups which he failed to mention in the picture.
>>
>>51503406
The map probably has a constant size if it's taking that long to initialize and in doing so it is probably also using that same time to write a non-null value into the map for all vacant slot points since null values are saved for use in character arrays. Maybe I'm off but no one makes a graph just to lie. It just can't be true.
>>
>>51503485
It's the latter. Multiple lookups. No way map can take 300ms to initialize.
>>
>>51503485
It might be using non-null values considering that it doesn't return a boolean value or an integer value from the map and returning a null value would cause the variable assignment upon return to fail.
>>
import sys
import struct

class record_t :
param_1 = 0
param_2 = 0
param_list = [ 0 ] * 10
def __init__( self, data ) :
unpacked = struct.unpack( "<bbBBBBBBBBBB", data )
self.param_1 = unpacked[ 0 ]
self.param_2 = unpacked[ 1 ]
for i in range( 10 ) :
self.param_list[ i ] = unpacked[ 2 + i ]
print( str( self.param_1 ) + ", " + str( self.param_2 ) + ", " + str( self.param_list ) )

def main( ) :
data = b'abcdefghijhi0123456789:;'

print( "var1 init: ", end = "" )
var1 = record_t( data[ :12 ] )
print( "var2 init: ", end = "" )
var2 = record_t( data[ 12: ] )
print( "var1 values: " + str( var1.param_1 ) + ", " + str( var1.param_2 ) + ", " + str( var1.param_list ) )
print( "var2 values: " + str( var2.param_1 ) + ", " + str( var2.param_2 ) + ", " + str( var2.param_list ) )

if __name__ == "__main__":
sys.exit( main( ) )


var1 init: 97, 98, [99, 100, 101, 102, 103, 104, 105, 106, 104, 105]
var2 init: 48, 49, [50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
var1 values: 97, 98, [50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
var2 values: 48, 49, [50, 51, 52, 53, 54, 55, 56, 57, 58, 59]


So it means that fields defined in main scope of class are instantiated only once and then copied into new objects? And the way they are copied depends on their type? Is there a reason to initialize any fields in main scope in any case then or all initializations should be always done in __init__?
>>
>>51503708
I don't really play with Python but if I'm understanding your code and its output correctly, I would imagine it is because the static initialization, which is the initialization of the whole file, places the data up higher in ram ( more quickly accessible although it doesn't do it on purpose ) and initialization during in the __main__ function writes the data beyond the class definition [spoiler]( to give the program time to grab the necessary data for calls from __main__ )[/spoiler] and within the closure for the main function which is also a shadowing point between the system and the classes. I should reiterate that I don't play with Python but perhaps the fact that your class is acting as a template rather than an explicit class might differentiate reasons for the need to use __init__ sometimes.

Did I understand your question?
>>
>>51502690
You forgot one, cunt.
>>
>>51504021
Not to feed the flame but racism based on ignorance can come from females too.
>>
>>51504021
Actually, no, you're right. I went a little too absract there.
>>
>>51503031
>Miller Rabin if 100% accuracy
You can just drive the error probability so low that cosmic radiation fucking up your deterministic primality test is more likely.
>>
>>51504069
can regard females too, anon
>>
how to compile Haskel
>>
File: Untitledx.png (5KB, 365x328px) Image search: [iqdb] [SauceNao] [Google]
Untitledx.png
5KB, 365x328px
How can I calculate L and R without using inverse sine functions?
>>
>>51506420
it's more about things you've done yourself
>>
>>51506751
want to know |LR|, what are the knowns?
>>
>>51504021
cunt. one, forgot You
>>
>>51506751
what is E ?
>>
>>51506751
>>51506816
D is a projection of C onto B.

A is the origin.

E is the point where CD intersects the circle.

A is (-0.9,-0.4) and B is (-0.1,-0.6).
>>
>>51506852
>>51506774
>>
>>51506852
if A is origin it;s (0 , 0).
the size of the circle seems arbitrary
>>
>>51500924
>wat r u working on, anon-chan ?
I'm trying to learn how to use love, my friend and I are going to try to make a game
>>
>>51506901
even if you mean C is the origin, the size of the circle is arbitrary
>>
>>51506901
A is the origin but not (0,0). I have to subtract A from the the other values. The size of the circle is related to how far I have gotten to figuring out LR. I need to figure out the points parallel to AB.
>>
>>51506920
The size of the circle is variable but relevant. I need to figure out the points on the circle parallel to the line.
>>
>>51501518
Prolog
>>
>>51506760
Thanks anon. Figured as much, so I deleted the post. Time to start my big boy portfolio now.
>>
>make a libgdx project
>it works
>close eclipse
>go to sleep
>open eclipse
>the project is now inside one folder in the project explorer
>can't use it
wtf man.

this is infuriating.
>>
so we have AB || LR
>>
>>51502682
>LabVIEW
dude it's easy
>>
>>51507046

Jaysus christ
>>
File: Capture.jpg (44KB, 723x289px) Image search: [iqdb] [SauceNao] [Google]
Capture.jpg
44KB, 723x289px
Guys im trying to put these methods inside a game of craps so it will count the WINS and LOSSES, but its giving me errors
>>
>>51507046
How's aero treating you?
>>
>>51507123
Did you decIare gameStatus?
>>
File: Capture.jpg (57KB, 419x694px) Image search: [iqdb] [SauceNao] [Google]
Capture.jpg
57KB, 419x694px
>>51507142
>>51507161
yes

all i have to do is just put the manyWon and manyLost in the end of the Craps code, but it wont work
>>
>>51507198
Shouldn't it be gameStatus.WON?
>>
>>51506936
>A is the origin but not (0,0).
that's not how it works lad
>>
>>51507222
Yes it is friend. A is equal to (0,0) after I subtract it from the other values. I gave A's initial value because I gave B's initial value.
>>
>>51507218
Never mind I just realised it's an enum.
>>
>>51507198
Why is it set to private?
>>
>>51506852
>A is (-0.9,-0.4) and B is (-0.1,-0.6).
In the diagram b is to the right of a so on a Cartesian plane the x of b should be greater than the x of a
which as you can see is not the case with the values you have given us

-0.9 > -0.1
>>
>>51507297
In what dimension is -0.9 bigger than -0.1?
>>
>best subreddit of /g/
>calling anything on 4chan a subreddit
literal cancer
>>
>>51507272
>>51507284
Alright i tried something else this time instead of using methods but I still have this problem where i cant get anything if its closed in brackets

System print wont work because it cant find wins or losses variables

            // determine game status 
if( sumOfDice == myPoint ) // win by making point
gameStatus = Status.WON;
else if( sumOfDice == SEVEN ) //lose by rolling 7 before point
gameStatus = Status.LOST;
}

int wins=0;
for(int y=1;y<1000000;y++)
{
if(gameStatus == Status.WON)
++wins;
}

int losses=0;
for(int z=1;z<1000000;z++)
{
if(gameStatus == Status.LOST)
++losses;
}
/*
// display won or lost message
if(gameStatus == Status.WON)
{
System.out.println( "You win!" );
}
else if(gameStatus == Status.LOST)
{
System.out.println( "You lost!" );
}
*/


}//end of for loop

System.out.println("WINS: "+wins);
System.out.println("LOSSES: "+losses);

}
>>
>>51507324
give us other coordinates
>>
>>51501483
you fucked up bro
>start as kid/0
>first loop, you set to squid/1 because kid is 0
>second loop, kid is still 0, you set you to squid/1
you never get the flipflopping behavior
>>
>>51507357
I can't because the only values I have physically input are A and B. Since people are being pissy about A being the origin but not (0,0) A is (0,0) and B is (0.8,-0.2). C is literally anything, D is a projection so the value is projBC and E is
glm::vec2 radiusIntersect(glm::vec2 A, glm::vec2 B, float radius)
{
glm::vec2 V;
float length;
//A is the origin //B is the vector //V is the output
length=sqrt( (((A.x-B.x)*(A.x-B.x))+((A.y-B.y)*(A.y-B.y))) );
//Calculate adjacent and opposite
B.x-=A.x; B.y-=A.y;
//Calculate cosine and sine
V.x=B.x/length; //cosine
V.y=B.y/length; //sine
//Calculate new vector of length "radius"
V.x=A.x+(V.x*radius);
V.y=A.y+(V.y*radius);
return V;

}
>>
>>51507356
is it C++? try cout
>>
File: Capture.jpg (51KB, 741x434px) Image search: [iqdb] [SauceNao] [Google]
Capture.jpg
51KB, 741x434px
>>51507368
no its just the wins and losses variables

it cant find it at the system prints
>>51507397
java
>>
>>51507411
it could be cause you are adding integer to a string
>>
>>51507411
You are adding an int to a character array. Try printing wins and losses separately.
>>
>>51506981
>libgdx
>eclipse
>java
hm
>>
>>51507250
for it to be at the origin it has to be at (0,0)
just because you can translate it to the origin doesn’t mean that it is "the origin". but arguing about this is pointless

>>51507324
sry m8 meant <
>>
File: Capture.jpg (52KB, 713x481px) Image search: [iqdb] [SauceNao] [Google]
Capture.jpg
52KB, 713x481px
>>51507430
>>51507452
not workng
>>
>>51507515
I literally just said A is (0,0), just not by default. The origin of those other points is (0,0) after I subtract A from them therefore A is (0,0) after that calculation.
>>
>>51507547
I'm not too familiar with java, is printIn print int?
>>
>>51507583
no print newline
>>
I'm pretty new to Java(studying CS in college) and I'm having a hard time understanding linked lists, I mean I have no bloody idea what to do. Our lecture notes are pretty shit. Anybody have any resources/videos to help me understand it better?
>>
>>51507547
Do normal
<code>System.out.print
?
>>
>>51507616
><code>
?
>>
>>51507608
check MIT
>>
<code>System.out.print</code>
>>
System.out.print
>>
>>51507547
What block does the
}//end of for loop

belong to?
>>
>>51507629
thanks
>>
>>51507547
I think you're declaring wins and losses within a loop anon. Declare them at the start of your main function and post results.
>>
>>51507458
what's wrong with them?
>>
>>51507703
OH YEAH

it loops the game a million times

im just gonna post the damn code
public static void main( String[] args ) 
{

//run game a million
for(int x = 1;x<1000000;x++)
{


int myPoint = 0; // point if no win or loss on first roll
Status gameStatus; // can contain CONTINUE, WON or LOST
int sumOfDice = rollDice(); // first roll of the dice

// determine game status and point based on first roll
switch( sumOfDice )
{
case SEVEN: // win with 7 on first roll
case YO_LEVEN: // win with 11 on first roll
gameStatus = Status.WON;
break;

case SNAKE_EYES: // lose with 2 on first roll
case TREY: // lose with 3 on first roll
case BOX_CARS: // lose with 12 on first roll
gameStatus = Status.LOST;
break;

default: // did not win or lose, so remember point
gameStatus = Status.CONTINUE; // game is not over
myPoint = sumOfDice; // remember the point
System.out.printf( "Point is %d\n", myPoint );
break; // optional at end of switch

}//end switch

// while game is not complete
while( gameStatus == Status.CONTINUE ) //not WON or LOST
{
sumOfDice = rollDice(); //roll dice again


// determine game status
if( sumOfDice == myPoint ) // win by making point
gameStatus = Status.WON;
else if( sumOfDice == SEVEN ) //lose by rolling 7 before point
gameStatus = Status.LOST;
}

int wins=0;
for(int y=1;y<1000000;y++)
{
if(gameStatus == Status.WON)
++wins;
}

int losses=0;
for(int z=1;z<1000000;z++)
{
if(gameStatus == Status.LOST)
++losses;
}

}//end of for loop

System.out.print("WINS: ");
System.out.println(wins);
System.out.print("LOSSES: ");
System.out.println(losses);


}
>>
>>51507768
try
 System.out.print(wins) 

?
>>
>>51507826
You are declaring wins and losses inside a for loop ya idjit.
>>
>>>51507851
he's got a point
>>
>>51507851
do i have to declare it again outside?
>>
>>51507904
Make a habit of declaring all variables at the top of the program.

Just change int wins = 0 and int losses = 0 to wins = 0 and losses = 0 and declare them at the start of your main function.
>>
>>51507904
declare them before the loop
>>
>>51507936
>>51507948
alright i will, happy turkey hunting
>>
Is it okay to write macros for functions that I want to check NULL for? like malloc() and fopen(), for example. I have loads of them everywhere and don't want to write "if (!thing) { fprintf(stderr, "Couldn't open file %s\n"); }" etc. Is it autistic to write a safe_fopen or something? My instructor wants us to check for every possibility and I really can't be arsed to do that and would rather just write a macro and find/replace all instances of fopen and malloc etc with their respective macros
>>
>>51501405
Write a shell
>>
do java pass by reference or by value?
>>
alright well im learning functions in c++ and I don't really understand why I cant have highscore above low score. Anyone help me out?

http://pastebin.com/YwkxnxV5
>>
>>51506981
i don't think i've had any problems with my eclipse setup in quite a while (knock on wood) but yeah you're in for a hell of a ride... especially if you decide to use JNI/NDK
>>
>>51508395
pass by value. except you pass references by value so it's not like you pass the actual object, you still pass "by reference" in some sense.
>>
>>51508395
By copy, which is usually lumped in with by value, but has some subtle differences.
void swap(int a, int b) {
int temp = a;
a = b;
b = temp;
}

If it was "true" by value, you wouldn't be able to assign to a and b because they would be ints, not storage for ints.
If it was by reference, the assignment would change whatever was passed in as a and b. Java doesn't.
Java and C let you assign to copies of a and b, without changing the original.
>>
I'm getting this exception:

Exception in thread "main" java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(Unknown Source)
at java.util.LinkedList$ListItr.previous(Unknown Source)
at fenn20.CarLists.main(CarLists.java:46)


Line 46:

System.out.println(lit.previous());


Here's the program:

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.ListIterator;

public class CarLists {
public static void main(String[] args) {
ArrayList <Car> cararray1 = new ArrayList <Car>();
cararray1.add(new Car("Toyota", "Corolla", 10000));
cararray1.add(new Car("Honda", "Civic", 5000));
cararray1.add(new Car("Honda", "Accord", 12500));
cararray1.add(new Car("Mitsubishi", "Outlander", 20000));
cararray1.add(new Car("Mitsubishi", "Lancer", 15000));
cararray1.add(new Car("Toyota", "Camry", 7500));

for (int i = 0; i < cararray1.size(); i++) {
System.out.println(cararray1.get(i));
}
System.out.println();
System.out.println("Most Expensive Car: " + Collections.max(cararray1, new CarComparator()));

LinkedList<Car> cararray2 = new LinkedList <Car>(cararray1);
cararray2.add(4, new Car("Hyundai", "Elantra", 3000));
System.out.println("Added New Car: " + cararray2.get(4));

Collections.sort(cararray2, new CarComparator());

System.out.println();
ListIterator<Car> lit = cararray2.listIterator();
System.out.println("In Increasing Order:");
while(lit.hasNext()){
System.out.println(lit.next());
}
System.out.println();

System.out.println("Removed First Car: " + cararray2.get(0));
cararray2.remove(0);
System.out.println("Removed Last Car: " + cararray2.get(5));
cararray2.remove(5);

System.out.println();
System.out.println("In Decreasing Order:");
while(lit.hasPrevious()){
System.out.println(lit.previous());
}
}
}
>>
>>51508533
Here's Car.java:

public class Car {
private String make;
private String model;
private double price;
public Car(String make, String model, double price) {
this.make = make;
this.model = model;
this.price = price;
}
public String getMake() {
return make;
}
public String getModel() {
return model;
}
public double getPrice() {
return price;
}
public String toString() {
return "Car: make=" + this.make + ", model=" +
this.model + ", price=" + this.price;
}
}


And here's CarComparator:

import java.util.Comparator;

public class CarComparator
implements Comparator<Car> {

public int compare(Car c1, Car c2) {

return new Double(c1.getPrice()).compareTo(new Double(c2.getPrice()));

}
}
>>
>>51508427
btw would it just be easier to use
 tags than pastebin?
>>
best language for game
>>
>>51508636
lisp
>>
>>51508636
rust
>>
>>51508636
C++ (performance)
java (productivity)
>>
Okay so i've been unemployed for several months now and I've been doing fuck all when it comes to projects or anything

How can I explain this when it comes to an interview? Can i just say I've been brushing up on other languages or something?
>>
>>51502715
i-is a qt trap programmer gf fine too?
>>
>>51508677
if you've been unemployed for more than 3 months, you are now officially unemployable
>>
Will deferred execution fuck things up if you use a LINQ query on a collection to perform some operation on that collection?

var itemsToRemove =
from item in SomeList
where !item.Validate()
select item;

foreach (var item in itemsToRemove) {
SomeList.Remove(item);
}
>>
>>51508934
Why can't you just do:
SomeList = SomeList.Where(item => item.Validate());
>>
File: umaru5.jpg (322KB, 1117x1024px) Image search: [iqdb] [SauceNao] [Google]
umaru5.jpg
322KB, 1117x1024px
>>51502864
>>
>>51508636
JAI :^)
>>
>>51508934
Yes. The timelines must never cross.
>>
What is the point of a linked list over any other continuous data structure?
>>
>>51509312
Different complexity for different operations. If you give an example of another data structure I can tell you when it's better and worse.
>>
>>51509342
How about an array?
>>
File: muh trees.png (157KB, 642x834px) Image search: [iqdb] [SauceNao] [Google]
muh trees.png
157KB, 642x834px
>>
>>51509379
Those darned white men! Is there any unfairness they won't use to oppress others?
>>
Lisp, Ruby sound gay
>>
Scrub-not-programmer pleb tier CSS question:

Will writing
.smelly a
select all <a> elements that are children of elements with class="smelly"?
>>
>>51509379
>being proud of being a bottomfeeding brainless webdev shitter who wouldn't even know how to implement any of the libraries she uses
>>
>>51509379
reverse (Tree left right) = Tree (reverse right) (reverse left)
reverse (Leaf x) = Leaf x


a-am I doing it right?
>>
>>51509372
In a linked list, you can insert and remove neighboring elements in constant time. An array would need linear time.

However, in an array you can look up the N'th element in constant time, while a linked list would need linear time.

If you frequently iterate over a list while adding and removing items, like in some form of queue, the linked list would be better.

If you mostly just look up by index with minimal insertion and removals, like when doing a binary search, the array would be better.
>>
>>51509312
1) You're going to iterate over all elements in any typical use case (don't need double links)
2) element count is not constant (avoid structures with expensive resizing)
3) elements are not uniform (iteration is non-trivial)

example: malloc
>>
>>51509436
>>51509379

binary tree reversal is the tech equivalent of "newfags cant triforce"

how can we expect you to contribute dank memes if you can't even get that top triangle to fall in line with the rest of em
>>
>>51502522
>Also, using eval in any language is like asking for a million security holes to open up in your program. Eval = evil.
>wat is lisp
>>
>>51509379
>Get a CS degree
>Go to a job interview
>Tested on something that was a mandatory part of the curriculum
>THIS IS OPPRESSION!!!! AND PATRIARCHY!!! FUCKING WHITE MEN RUIN EVERYTHING!!!!!
Yup... All I'm seeing is a typical feminist in tech being a typical feminist in tech.

Seriously, not only getting worked up about being tested on something that was a mandatory part of your curriculum, but also on the gender and race of the person doing the testing? However I guess this is to be expected with the way modern day feminism tells women that there is no such thing as an incompetent woman and that only men can be incompetent.
>>
>>51509436
cishet male scum detected, problematic af
>>
WW3 HAS BEGUN
>>
>>51502983
fermat test
>>
>>51509418
It will, yeah
>>
>>51509538
Are you implying lisp programs use eval a lot for some reason that I've never fucking heard of?
>>
>>51509544
>get a CS degree
Where did she mention having a CS degree? If anything she has a SE degree.

>mandatory part of your curriculum
There is no standardized CS/SE curriculum.
>>
>>51509544
Women are equal though!
>>
>>51507198
>not using a fixed width font
>>
>>51502989
this post is proof of the insecurity inherent to tripfags
>>
>>51509546
but I'm none of those things :c
>>
>>51509614
he's also demonstrated his autism on various occasions.
>>
>>51508636
Racket
>>
File: sussman shig.jpg (71KB, 500x375px) Image search: [iqdb] [SauceNao] [Google]
sussman shig.jpg
71KB, 500x375px
>>51509571
It's like you haven't read your daily SICP. Using eval for specially constructed environments is quite useful.
>>
>>51509599
Where does it say she's got a SE degree? Let's not forget that CS has become the general word for "degree to do computer stuff" these days.

Also, while there isn't a standardized curriculum, apart from really shitty schools that teach a "For Dummies" version of SE as CS, pretty much all schools that teach CS have roughly the same curriculum. Some schools teach Comp. Eng. as CS and my Comp. Eng. undergrad curriculum had binary trees working with them the second year.

So unless you've gone to a really shitty school or are one of those "self taught" people being stumped by having to work with binary trees is really just a sign of ether being stupid or lying about your degree.
>>
>>51509379
void reverse(struct tree *root)
{
if (root)
{
reverse (root->left);
reverse (root->right);
SWAP(root->left, root->right);
}
}

r-right?

>>51509599
>SE degree
literally code monkey
>>
>>51509571
I think he's implying that the problems with "eval" only apply to the combined read+eval found in most interpreted languages, not to Lisp's eval (which takes a parse tree as input, not a string).

Combined read+eval is prone to injection attacks because of the "read" part, i.e. you're constructing a string which is going to parsed. That doesn't apply to Lisp's eval, as you provide a parse tree rather than a string.
>>
>>51509670
I see, you're just memeing.
>>
>>51509697
ignore this b8 repost
>>
>>51509529
no it would be like if a nigger applied to be a journalist and all they know is some very broken child-tier english and no understanding of press ethics or how the world works etc
>>
>>51509703
cishet male scum detected
problematic af

you have no right to mansplain CS like that
>>
>>51509710
which is why reader macros are evil, not eval

But yes. It's actually interesting that lisp also gets shit on for being "dynamically typed" when 99% of the evils of dynamic typing occur in the same shit languages you refer to.
>>
which one
https://www.bento.io/grid
>>
>>51509833
>all the tutorials are python or js based
none of them
>>
can i do this in C
else
for(;;)
if(true)
statement;

or will i have to use braces
>>
>>51509896
c# is js based?
>>
>>51509909
If only there were some way to enter this statement in a file and try to compile it and see what happens.

Oh well, I guess we'll never know for sure!
>>
>>51509909
that is disgusting
>>
>>51509719
>Original post
>b8
Aww.... Did the little feminist get a bit asspained?
>>
>>51508636
C.
>>
>>51509960
i mean the twitter image, posted everyday
>>
>>51509991
it's from fucking August
>>
>>51507123
>>51507198
gameStatus is not in the scope of either manyWon() or manyLost() because it's declared in the main method. Make it a static field for the class.
>>
>>51509982
well memed my friend
>>
>>51508636
C for engine, lithp and C for scripting.
>>
>tfw you figure out linked lists and you literally eat up all 32GB of memory in a few seconds

This is really fun, desu.
>>
>>51508636
Honestly this >>51508646
>>
>>51509909
yes, you only need braces when the body is composed of multiple statements. Each of those is only a single statement.
>>
Anybody here with some know how of jenkins?

I have to set up phpunit for unit tests and codesniffer for static code analysis for a php project on our server.

I was testing it on my pc.
While everything works fine locally (I run test from cmd with simple phpunit --bootstrap.. or phpunit --configure autoload...) on jenkins it is not working.

phpunit works itself (I can run phpunit during build but without arguments) if I put phpunit phpunit.xml or any other file as argument it fails and there is warning that
it could not open file.

I tought that there is something fucked up in my path files. but it works locally on my pc.


any ideas?
>>
>>51511070
read the error log nigger
>>
>>51510411

muh
data
structures
>>
File: 1397339340537.jpg (2MB, 2000x2610px) Image search: [iqdb] [SauceNao] [Google]
1397339340537.jpg
2MB, 2000x2610px
if you write
return EXIT_SUCCESS;

instead of
exit(EXIT_SUCCESS);


please stop writing C
>>
File: off the board.jpg (200KB, 691x478px) Image search: [iqdb] [SauceNao] [Google]
off the board.jpg
200KB, 691x478px
>working today
>>
Working on a HTML5 chatroom:

http://raskie.com:85/

Ideas, opinions, bug reports, and general BS most welcome.
>>
>>51511408
int main()
{
goto past_end;
end:
return EXIT_SUCCESS;
past_end:
// code here
goto end;
}
>>
>>51511408
>using return
>using exit
>>
>>51511439
I have literally zero need for another way to tell people to kill themselves.
>>
>>51511209
>Could not open the file
>>
I'm building a calculator in JS.

I want to have it so that if you click an operator (+, -, /, *) when the most recent button pressed was also an operator, that the previous operator input is replaced by this new operator input.

I've coded a function below which I expected to work, but it doesn't. I've no idea why - it looks fine to me. Any thoughts?

// answer is storage variable for equation to be worked out upon pressing equals

$(".operator").click(function () {
if (answer.charAt(answer.length - 1) === "+" || answer.charAt(answer.length - 1) === "-" || answer.charAt(answer.length - 1) === "/" || answer.charAt(answer.length - 1) === "*") {
answer.splice(answer.length - 1, 1, $(this).text());
} else {
answer += $(this).text();
}
$(".display").text(answer);
});
>>
>>51511767
try writing better procedures

for instance, apply
>>
>>51511767
I'm a moron. I'm calling an array method on a string

WEW
FUCKIN
LAD
>>
>>51512006
a string is an array of characters
in most languages you can call array methods on strings
>>
I want to learn C++, and a friend recommended I try SICP. The exercises are bloody difficult. Should I just give up lads?
>>
I'm looking to pick up another programming language. Proficient in C, developing greater proficiency in C++ (and to a lesser degree Matlab) suggestions?
>>
>>51511767

Don't listen to the 'scientist' talking shit about arrays and strings. Worry more about the size of your if/control statement.

It's fucking obscene.

Also... Currently working on a realtme HTML 5
chatroom:

http://raskie.com:85

Pls drp bi.an chk it out.
>>
Is using recursion for traversing a tree in C legitimate (or any use of recursion in C)? It's the most elegant way of coding it, but won't you just get a stack overflow with a moderately small N?
>>
>>51512395
>using recursion for traversing a tree in C legitimate

Yes.
>>
>>51512171
Are you retareded? Learning the fundamentals of a language like C++ is super easy, takes like 1 week. If this is your first language and you expect programming to be your future, give up.

sicp isn't related to c++, its for creating compilers.
>>
>>51512395
You should avoid using recursion in C unless you have a small, bounded n.
>>
>>51501483
I didn't know that C let you use 1 as the name of a function!
>>
>>51501323
No it's not. C++ is mostly disliked because it is inconsistent. You need not enforce this property, but shall instead try to avoid it.
>>
>>51512478
retard
>>
>>51512589
How is what I said retarded?
>>
>>51500924
what are some good mips resources?
>>
>>51512395
Recursion is legit, but you can't rely on TCO
>>
>>51512655

The trash can, where it belongs.
>>
>>51501323
If you're doing to use C++, then write idiomatic C++ code. Stay with C if you really love C that much.
>>
>>51512655
Everywhere. MIPS is taught everywhere in any course that teaches computer organization.
>>
>>51512646
because youre retarded
>>
File: 1377982563750.png (240KB, 500x540px) Image search: [iqdb] [SauceNao] [Google]
1377982563750.png
240KB, 500x540px
Having trouble trying to get bullet physics to work with my c++ project, i followed these instructions but i get errors afterwards.
http://bulletphysics.org/mediawiki-1.5.8/index.php/Creating_a_project_from_scratch
>>
our beautiful thread...ruined!

i miss ruby
>>
>>51512820
I can't telepathically know what your error was. Tell us what it was.
>>
>>51512820
What errors
negar
>>
>>51512006
>I'm calling an array method on a string
They joys of dynamic typing
>>
>>51512853
make me :^)
>>
>>51512395
No, because you're going to blow the stack with call frames.

>>51512446
>>51512754
You can't write robust, recursive code in languages that don't guarantee tail-call optimization. It's simply a bad idea for code that needs to not crash your program.
>>
>>51512849
>>51512863
it said some about missing dependencies, i googled and it said that i was missing .lib files. But i dont see any lib files even after generating with cmake.
>>
/!\ OFFICIAL MEME ALERT /!\
NEW THREAD

>>51512898
>>
>>51512888
reeeeeeeee
post all the log
>>
>>51512233

Would seriously like some testers for this.
Most of the features I need to test need live user over a network. All your datas are safe with us.
>>
>>51512883
You're as shit at programming as you are with trolling.
>>
>>51513044
Let me try, let my try!

huh... it goes like this

You are as autistic with language standards as you are with shitposting.

Oh my god, it feels so... not great. I thought it would be amazing to post like you but I feel nothing.
Thread posts: 308
Thread images: 34


[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]
Please support this website by donating Bitcoins to 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
If a post contains copyrighted or illegal content, please click on that post's [Report] button and fill out a post removal request
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 4Archive shows an archive of their content. If you need information for a Poster - contact them.