[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: 319
Thread images: 34

File: C stella no mahou.jpg (154KB, 1280x720px) Image search: [Google]
C stella no mahou.jpg
154KB, 1280x720px
old thread: >>57099132

What are you working on, /g/?
>>
reposting (no answer last thread)

Hey deepeetee, I have a question.

Take languages where method lookup is done by searching associative tables with strings as keys at runtime, such as Python, Lua, or Javascript. Why don't people use arbitrary object as keys for methods? (Or do they?) The idea behind my question is that, while strings are fine for objects whose class you know in advance, in generic code that would simplify stuff by making name collisions a non-problem. It's possible to choose the same method name as some unrelated interface/protocol --- and then when a class wants to implement both, they conflict --- but it's not if you have to explicitly create a dedicated unique object.

Lua proof of concept
-- OK so I just decided lua's length operator sucks so I'm making my own.
len = {}
setmetatable(len, len)
function len:__call(other)
return getmetatable(other)[self](other)
end

implementor = {}
setmetatable(implementor, implementor)
implementor[len] = function(self)
return -42
end

print(len(implementor)) -- prints '-42'

-- I even get to copy the method in an intuitive way!
size = len
print(size(implementor))
-- And of course, if another module has a len, it'll always be unambiguous which one it is.


Notes:
I noticed it won't necessarily play well with the established syntax of JS and Python, but they could certainly be extended.

Python doesn't allow for non-string keys on classes, brb writing a PEP about it.
>>
File: haskell..png (7KB, 397x131px) Image search: [Google]
haskell..png
7KB, 397x131px
First for Haskell

God Save The Queen
>>
>>57103483
Nope, the free function operates on a copy of that pointer. Whatever you assign it within the function scope has fuckall consequence on the original object.
>>
haskell is as bad as hillary clinton
>>
/a/ is discussing programming and it's cute to watch

>>>/a/148613204
>>
File: its_infinite.jpg (34KB, 720x576px) Image search: [Google]
its_infinite.jpg
34KB, 720x576px
>>57101174
>>
>>57103536
But we're talking about the latter approach you mentioned?
>>
File: code.png (33KB, 730x323px) Image search: [Google]
code.png
33KB, 730x323px
>>57103521
With proper syntax highlighting if you want it.
>>
>>57103583
It's infinite
>>
For my algorithm analysis project, my partner has been copying code from university hubs. I got restless this weekend and implemented a permutation algorithm without any help from the web. The code isn't super optimized but I was considering just making it my pet project

So far it (verifiably) works for n <= 5 but our next project will require parameters up to n = 10. No way am I about to verify that by hand and I've already done some digging and no easily findable site provides this type of permutation sequence

Should I send my code to my partner and potentially save him some time or just let him do his usual stitching?
>>
So in C, when you allocate some memory using malloc() then free the memory using free() how does the computer know how much of the memory to free? Like when you have, say, a huge char that contains a sentence, how does it know to delete just the sentence and not anything past that even though you don't pass the size to free()?
>>
>>57103596
>>57103583
A loop that never terminates. It just loop an unbounded number of times.

while True:
print('hello')

Textbook infinite loop: given that 'True' is obviously never becoming false, the program prints hello an infinite number of times without ever stopping by itself
>>
>>57103667
>given that 'True' is obviously never becoming false
Actually...
With a little bit of hacking, you can change the value pointed to by the True object and make it false.
>>
>>57103514
where is my qt boipuC
>>
>>57103661
This is implementation defined.
I think GCC handles this by keeping a heap table and the actual size of the memory block right before the the pointer returned by malloc.
It's pretty stupid because if this was made a standard language feature, strlen and every other array traversal function could be a O(1) operation.
>>
>>57103661
metadata that's maintained by the malloc implementor.
>>
Hack of the day:

asm volatile("mfence":::"memory");


How to tell your compiler's optimizer to fuck off and leave your code alone.
>>
>>57103700
>>57103707
Oh so just some abstraction that keeps track of it, okay, thanks.
>>
what is the best language to be a fanboy of?
>>
Reminder that Facepunch is the best programming community on the internet.

https://facepunch.com/forumdisplay.php?f=240
>>
>>57103700
Yes but this way malloc can return a buffer bigger than what you've actually asked for, to pave the way for potential future reallocs.
>>
>>57103755
The one you wrote yourself.
>>
>>57103755
java
>>
>>57103640
I don't really get what you are talking about.
I guess with 'permutation algorithm' you mean a function which spits out all permutations of a word?
And you verify it how? With Hoare logic?
>nd no easily findable site provides this type of permutation sequence
what?
>>
Can programming transform you into a cute girl?

I want to be a cute girl.
>>
>>57103755
Haskell. You can be smugly superior about functional purity while shitposting esoteric solutions to fizzbuzz and other inane programming "challenges" posted to /g/
>>
>>57103570
>ou have your recursive function that reads in the lines, and then you have to actually count the words in each line with another recursive function that you call within your original function, but this approach leads to you declaring a bunch of functions that aren't really reusable
On the contrary, your functions are highly reusable.
What can't you reuse in something like
Lines = read_lines(Myfile, []),
Count = count_words_multiple_lines(Lines),

read_lines(File, Previous_lines) ->
case number_of_lines_left(File) of
0 -> Previous_lines;
_ -> read_lines(File, [read_a_line(File), Previous_lines])
end.

count_words_multiple_lines(Lines, Word_count) ->
case Lines of
[Head, Tail] -> count_words_multiple_lines(Tail, Word_count + count_words_line(Head, 0));
_ -> Word_count
end.

count_words_line(Line, Word_count) ->
case Line of
[Head, Tail] -> case is_separator(Head) of
true -> count_words_line(Line, Word_count + 1);
false -> count_words_line(Line, Word_count);
_ -> Word_count
end.
>>
>>57103810
I wish...

>>57103755
Erlang I guess.
Hakell is good too, but it has become too memetic (on here).
>>
>>57103814
this is all i do desu
>>
>>57103810
Starting an internet image board can
>>
Not shilling the 24" U2515H, but I use them for work and one for home. Curious if there are any better ones with the main use being programming?
>>
Oh a new thread, ok then.

>>57103865
Here's my chat logger, it can parse messages and display them in the 'HUD'

        public static function logMsg($message) {
if(!array_key_exists('logs', $_SESSION)) {
$_SESSION['logs'] = array();
}
if (array_key_exists('logs', $_SESSION) && count($_SESSION['logs']) === 20) {
for($i=0; $i<10; $i++) {
unset($_SESSION['logs'][$i]);
}
$_SESSION['logs'] = array_values($_SESSION['logs']);
}
$_SESSION['logs'][] = $message;
}

public static function getMsg($type) {
switch ($type) {
case 'move' :
$message = array(
'You head :direction: and find nothing.',
'After going countless footsteps :direction:, you find nothing.'
);
break;

case 'blocked' :
$message = array(
'There seems to be something blocking your path :direction:.'
);
break;
}
return $message[rand(0, count($message) - 1)];
}

public static function cleanMsg($message, array $params) {
if (array_key_exists('move', $params)) {
$message = str_replace(':direction:', '<span class="direction">'.$params['move'].'</span>', $message);
}
if (array_key_exists('enemy', $params)) {
$message = str_replace(':enemy:', '<span class="enemy">'.$params['enemy'].'</span>', $message);
}
if (array_key_exists('playerattack', $params)) {
$message = str_replace(':playerattack:', '<span class="playerattack">'.$params['playerattack'].'</span>', $message);
}
if (array_key_exists('enemyattack', $params)) {
$message = str_replace(':enemyattack:', '<span class="enemyattack">'.$params['enemyattack'].'</span>', $message);
}
return $message;
}
>>
>>57103814
>t. never written a single line of hasklele
>>
>>57103882
>U2515H
seems good
>>
>>57103911
I discovered ternary operators a bit ago and I love them.

        public static function isWalkable($map, $y, $x) {
return (isset($map[$y][$x]) ? $map[$y][$x]['isWalkable'] : FALSE);
}
>>
>>57103968
I've never ever had a legitimate use for the ternary operator.
>>
File: 5.png (521KB, 831x762px) Image search: [Google]
5.png
521KB, 831x762px
>>
>>57103514
Is there anything wrong with learning to code on a need to know basis?

I know a lot of intermediate, and a few advanced and niche topics, but if you were to ask me some of the basics, I would have no idea.
>>
File: 1462062883149.png (32KB, 838x101px) Image search: [Google]
1462062883149.png
32KB, 838x101px
What did Python mean by this?
>>
>>57104040
>What did Python mean by this?
what did this macfag mean by this?
>>
>>57104005
the ternary operator is an expression contrary to if/else
>>
>>57104075
>C:\Users
>macfag
>>
>>57104075
>C:\Users\...
>macfag
>>
>>57104075
>C:\Users
>mac
>>
>>57104075
>C:\Users\
>mac
>>
>>57104018
What you're asking isn't possible.

if you don't know the basics, how do you expect to build anything larger than a toy command line calculator?
>>
>>57104005
string result = isCorrect ? "Correct answer." : "Incorrect answer."

vs.

string result = "";
if (isCorrect) {
result = "Correct answer.";
} else {
result = "Incorrect answer";
}
>>
>>57104141
I prefer:
map<bool, string> CorrecntessResults = {
{true, "Correct answer."},
{false, "Incorrect answer."},
};

string result = CorectnessResults[isCorrect];
>>
>>57104177
Yeah but you don't actually tho, right?
>>
>>57104198
why not :^)
>>
>>57103810

No. Programming cannot change your physiology or sex at all.
>>
Anyone ever used AutoIt?

I have a script that I use that enters a password into a form for client software. Say for instance the password is "password". The first iteration of the loop, it will input "password" into the field and everything will work fine. The next iteration will type in "assword".

Even if put the password in a variable, and retrieve the value from the variable, it will make the same mistake and I can't understand why.

If I write the password to a log file, the password in the log file will be correct. What is the issue??
>>
>>57104018
Yeah. Nowadays it's probably become more important to know where the information is rather than knowing it by heart. And you also get to type in the program to see what it does. Imagine being offered to fill in a huge questionnaire of 'what does this ultra tricky stuff produce when ran'... ain't real-world pragmatic stuff. (Inb4 o'reilly copying and pasting from stackoverflow meme) I'd advise one more thing: get acquainted with the canonical source of information (the specification for most langs, cppreference.com for C/C++) You will follow a tutorial at first and there's nothing wrong with that, but being able to follow the language designers' logic is how you truly prove yourself. Same goes for libraries, reading the sourcecode is also bonus points in that case.
>>
>>57104218
I identify as a template, and this triggers me
>>
>>57104240
found u http://comments.deviantart.com/1/634439761/4223702014

>>57104234
>assword
heh.
>>
>>57104198
Now that I think of it...

#include <map>
#include <string>
#include <iostream>

struct ResultContainer
{
std::map<bool, std::string> results = {};

ResultContainer &setResult(const bool &k, const std::string &v) {
results[k] = v;
return *this;
}

const std::string getResult(const bool &v) {
return results[v];
}
};

int main(int, char *)
{
bool isCorrect = true;
std::string result = (ResultContainer{})
.setResult(true, "Correct answer.")
.setResult(false, "Incorrect answer.")
.getResult(isCorrect);

std::cout << result << std::endl;

return 0;
}
>>
>>57104141
But i always tend to want to do other stuff as well, if the result is incorrect, and not just set one variable value.
>>
>>57104134
Disagree. Programming is applied and ever-changing knowledge, not learning the epic poem word-for-word from start to finish. And if that's not what you meant then either you or I didn't get his question.
>>
>>57104289
>all this bloat to do something simple

sigh...
>>
>>57104234
The password is probably being typed before the input field is selected.
>>
>>57104291
Yeah 9/10 times, but I just wanted to play ternary operator's advocate.
>>
>>57104289
results should be private
>>
>>57103514
Is this show any good or is it like new game where it has zero depth and it's just cute girls doing cute things at work.
>>
>>57103514

How can I debug opengl shaders

I don't want to step through them or have breakpoints, I want to view what data they expect vs. what data they get

the whole system of setting up vertex attributes and shit confuses me
>>
>>57104040
>python on windows
install gentoo
>>
File: 1476631300937.png (61KB, 600x600px) Image search: [Google]
1476631300937.png
61KB, 600x600px
>>57104393
>>
File: comeHomeWhiteMan.jpg (391KB, 1920x1080px) Image search: [Google]
comeHomeWhiteMan.jpg
391KB, 1920x1080px
>>57104401
>>
>>57104378
read the specification (just the parts you're struggling with)

then get errors with glGetShaderInfoLog and you can put things in the shader code like for example make something red based on a condition
>>
>>57104313
Hmm, I'll look into that, you might be right. I'm pretty sure I even tried ppassword but that didn't work either. I even tried making it sleep for 7 seconds before it ran. I'll check and see if the cursor is visible in the password field while it sleeps
>>
What are some good C++ projects for a portfolio? I need some work samples for job applications
>>
>>57104289
>>57104177
I hope you're joking desu
>>
>>57104506
I hope you have plenty of time on your hands.
>>
>>57104506
File directory
>>
>>57104513
y?
>>
>>57104525
Yeah
>>
>>57104289
What

char* results[2] ={"Correct answer.", "Incorrect answer."};


Faster, simpler and doesn't import retarded libraries.
>>
>>57104535
because it's encoding a total 2-case function in a map with and accessing it with inherently partial function (lookup)

it's just gross and only "happens" to work
>>
>>57104585
>it's just gross and only "happens" to work
No.
>>
File: shot.png (34KB, 678x372px) Image search: [Google]
shot.png
34KB, 678x372px
I am retarded and missing something, or does python not handle this kind of recursion?
>>
If I have a function to mess around with some comboboxes in wpf, c#, how can I pass in the comboboxe(s) I want the function to work on as a parameter? Maybe some casting from object or something?
>>
>>57104601
here you go
def simplerecursion(n,i):
liss = [k for k in range(n)]

return liss if not i else simplerecursion(n,i-1)
>>
>>57104598
ok then keep writing retarded code
>>
>>57104601
.extend is inplace and returns None, tard.
>>
>>57104689
Thanks, fellow dipshit.
>>
>>57104555
This is bait right?
>>
File: 776.gif (849KB, 200x200px) Image search: [Google]
776.gif
849KB, 200x200px
>>57104289
>map
>bool
>>
>>57104177
Should be
string result = isCorrect[CorectnessResults];
>>
Using the android google maps api how would I calculate the distance from you location to a marker object? Or how would I get the time elapsed and put it on the marker? I know I have to use the utility api, but I just don't have a lot of time on my hands.
>>
>>57105160
http://stackoverflow.com/questions/18310126/get-the-distance-between-two-locations-in-android

google is hard
>>
>>57105187
sorry I don't know how to code and this is just so I can say I did something
thanks anon
>>
>>57105224
yeah okay, good luck with the rest of the interview
>>
>>57105235
what was that matt?
>>
>>57104619
Combobox is a class, just

yourMethod(Combobox cb) {
//stuff
}
>>
>>57105320
Thanks friendo
>>
How do I format my code on here?
>>
>>57105362
< pre language="language_name" >
// your code
< / pre >

without spaces
>>
>>57105362
>>>/g/rules/3
>>
what happens if i forget a closing tag?
>>
>>57105385
That works, if you have a capcode.
>>
What if
[/code]
i forget an opening tag?
>>
>>57103755
arm asm.
>>
Really makes you think...

https://www.reddit.com/r/haskell/comments/45q90s/is_anything_being_done_to_remedy_the_soul/
>>
>>57105529
Protip: ALT+C if you have 4chan X
>>
>>57105573
>Posting a link to reddit
I think you should leave.
>>
How fast is it possible to learn arm or x86 ASM? I assume there is not a huge market for those programmers?

How fast can I start earning money in webdev if I only know how to write basic functions in Python? A few months?
I have vocational school (hope that's the right term, im EU fag).
I don't know what I'm doing with my life.
>>
>>57105709
Nobody will hire a 20-something "embedded" dev with zero experience, ageism in embedded is very real.

Nobody writes pure ASM applications in higher level fields, if a bottleneck is found, it's isolated and the bottleneck function is written as standalone ASM to improve performance when necessary.
>>
>>57105752
so C at best I guess. Feels bad man.
>>
>>57105187

I wouldn't trust any distance algorithm without testing it

they can be really shitty

if you want it to be accurate you need to make a google api call
>>
>>57105752
If you're trying to get a job, ASM is probably not a good idea.
Lots of openings for sould-crushing webdev jobs though.
>>
Why doesn't this work, I wanna have the data of x be the first element of the array. I'm new to using pointers so be nice. :>
>>
>>57105777
It makes sense.
In embedded, you can't just release a patch to fix bugs.

If your faulty code goes into production, the entire production run has to be scrapped, or worse, can cause customers to fly off a cliff.
>>
>>57105807

How fast can one learn enough of the webshit stack to snag one of these jobs as a last resort?
>>
my name is annon and I have a problem, when Im get behind a computer, I make temperature converters, in the past I have made

>c
http://pastebin.com/uzwu6Dcw
>python
http://pastebin.com/ynmZiKJe
>js/html
http://pastebin.com/KKBKh6n0
http://pastebin.com/QqhcPtKa
>ruby
http://pastebin.com/2uicMABx

my fingers are starting to itch, I might make a java, or haskell next!
>>
>>57105886
If you've never programmed before, maybe a couple months until you can do a terrible but working job.
If you already know how to code, webdev is just learning the hot JS framework of the month.
>>
>>57105817
Got to dereference list
>>
>>57105824
If no one hires zero-experience people, how the fuck do people get experience?
>>
>>57105887
Make it in x86_64 ASM and I'll respect you.
Make it a kernel module or a standalone bootable
kernel and I'll be impressed.
>>
>>57105923
Open source projects, and then reference your GitHub in the interview.
>>
>>57105923
It's not about what you know, it's who you know.
Friendless losers with no connections are literally and figuratively unemployable for all intents and purposes, college or no college.
>>
need advice g, i must develop a web project for college and it has to be mainly in java + oracle db, i don't know if it's better (faster) to do it with jsf+jsp (must learn them) or use a framework like jersey to make a rest api and use angular for the front end.. i've got no experience with neither jsf, jsp or jersey but i do have a little with angular... what should i do?
>>
>>57105817
try
list = &x;
alist[0] = *list;
>>
>>57105948
Good companies don't hire on referrals without also doing an interview, because referrals have been shown to be no better than random at finding good candidates.

The good developers get spammed with offers and pick the most interesting ones. And I'm not just saying that because Google recruiters have contacted me before ;^)
>>
>>57105817
Should be
&list = alist[0];
*list = x:
First you assign where list points to, then assign a new value to wherever it points to.
>>
>>57105919

I'm already a programmer, but most of what I know is C programming. Unfortunately, most of the jobs around where I live are webdev, and so I'd like a decent backup plan.
>>
>>57106000
Webdev is something I'd do only for money.
The languages are horrible (PHP, Javascript, ...), the tech stack is completely broken and being rewritten every other week.
Your code has to go through a dozen translation layers, build tools and package managers before you start seeing actual HTML/CSS.
And the people you work with usually care more about experimenting with the new shiny than getting shit done and writing clean code.
>>
This isn't really the thread to ask, but it's the most suited I can ask.

A friend sent me this code


373762 618551 . 618551 747825 526328 784122 774811 112856 764778 618551 . 314317 747825 661173 784122 762358 661173 485114

What did he mean by this?
>>
>>57105934
section     .text
global _start

_start:

mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80

mov eax,1
int 0x80

section .data

msg db 'noped dafkout',0xa
len equ $ - msg
>>
>>57106033

>Webdev is something I'd do only for money.
Same. But In about a year, I'm going to be graduating with a master's in CS, and I do need a backup plan in case I can't use any of my C programming ability in the workplace.
>>
>>57106113
Tsk, 32bit code.
>>
>>57106123
My advice is to expand your horizons now to as many popular languages as you can, and then pick something moderately popular that you like.

If you already know C, then you know how a computer work and you won't have much trouble learning other languages.
>>
>>57104506
This, I need some ideas.
>>
>>57104506
>>57106199
bumps
>>
Any good books for getting into C++ that aren't for beginners?
>>
>>57104506
Contribute to a big open source project.
Get patches into LibreOffice, Firefox, etc
>>
>>57104005
printf("String is %d character%c long\n", strlen(str), (strlen(str) == 1) ? 0 : 's');
>>
>>57106226
C++ primer, I am currently doing that and the pace is pretty good for a programmer and its like a normal read until you get to the core parts

its kind of long though, and there is https://www.amazon.com/dp/020170353X/ if you want to get straight to writing code
>>
>>57103803
>I guess with 'permutation algorithm' you mean a function which spits out all permutations of a word?
I give it an int and it gives me all the permutations of 1...n in a specific sequence due to the algorithm
>And you verify it how? With Hoare logic?
No, I don't need to formally prove it. I was just verifying that the sequence of outputs was correct
>>nd no easily findable site provides this type of permutation sequence
>what?
I haven't be able to find a website that gives me the precise sequence of output for a given n produced by this algorithm

Also, none of those questions had anything to do with the point of my initial post.
>>
>>57106389
>writing a null character to stdout

delete this
>>
>>57106389
I guess it could have been useful to know the ternary operator back when i was a newbie who wrote "Hello, [insert name here]!" tier programs and might have cared about correct English formated output.
>>
I dug myself into a whole by deciding to use pygame for an assignment. I'm using pgu to create a GUI. How can I grab input from an input box n pgu? Whenever I try to return the value that's in the box, all I get is the initial value that I set up to be the default.
>>
>>57103740
Yeah. if you want to sidestep malloc for whatever reason, you can always manage the heap yourself with brk or sbrk.
>>
>>57106473
Yeah, %s with "" and "s" probably would have been better.
>>
>>57106746
an empty string is just an array of size 1 with the only element being a null terminator.
>>
>tfw only recently started learning how to code while most other people in my class probably been doing this since middle or high school
I fucking hate myself I wish I didn't have to fucking suffer.
>>
File: 1476649735439.png (6KB, 616x79px) Image search: [Google]
1476649735439.png
6KB, 616x79px
>>57105973
this worked ty!

I've finished my logic for my program for the question in the image. The issue is at end of running the program, I get "***stack smashing detected, Abort (core dumped). Why is that? This is the program so far.


[#include <iostream>

using namespace std;

int main()
{
int x;
int y;
int z;
int alist[2];
int temp;
int *list;

cout << "Place a value for x" << endl;
cin >> x;
cout << "Place a value for y" << endl;
cin >> y;
cout << "Place a value for z" << endl;
cin >> z;

if(x>y)
{
if(x>z)
{
list = &x; //X is Pos. 1, Y is Pos.3, Z is Pos. 2
alist[0] = *list;
// cout << alist[0] << endl;
list = &y;
alist[2] = *list;

list = &z;
alist[1] = *list;
}

else
{
list = &x;
alist[1] = *list;

list = &y;
alist[2] = *list;

list = &z;
alist[0] = *list;
}
}
else
{
if(y>z)
{
list = &x;
alist[2] = *list;

list = &y;
alist[0] = *list;

list = &z;
alist[1] = *list;
}

else
{

list = &x;
alist[2] = *list;

list = &y;
alist[1] = *list;

list = &z;
alist[0] = *list;
}

}

cout << alist[0] << endl;
return 0;

}

]
>>
>>57106830
I fail, why didn't the brackets work. :>
[]
>>
anyone want to help me with this wargame level? i'm on level 14 of bandit on over the wire. on level 13, there was a file sshkey.private that you could use to ssh into bandit14@localhost from bandit13.

the hint for level 14 is
>The password for the next level can be retrieved by submitting the password of the current level to port 30000 on localhost.

how do i find the password of the current level i.e. 14? i don't know it because i got here by using the ssh key from level 13, not by using a password. i found a directory .ssh that has a file authorized_keys. it says

ssh-rsa (followed by a long string, and ending in:) rudy@localhost

the string isn't a password

i've tried ssh'ing into rudy@localhost and it doesn't work. i did ssh rudy@localhost -p 30000 and it tells me connection closed by remote host
>>
>>57106809
It won't print the null though.
>>
>>57106816
Don't compare yourself to anyone but yourself.
>>
>>57106891
Doesn't make me feel like any less of a retard.
>>
>>57106816
I started programming a few weeks before I started CS and I'm pretty good, for sure better than all my friends. If you're not a noob and you actually do stuff outside of class you should easily improve
>>
I think I fixed it, so why do i get a stack smashing error. :>


#include <iostream>

using namespace std;

int main()
{
int x;
int y;
int z;
int alist[2];
int temp;
int *list;

cout << "Place a value for x" << endl;
cin >> x;
cout << "Place a value for y" << endl;
cin >> y;
cout << "Place a value for z" << endl;
cin >> z;

if(x>y)
{
if(x>z)
{
list = &x; //X is Pos. 1, Y is Pos.3, Z is Pos. 2
alist[0] = *list;
// cout << alist[0] << endl;
list = &y;
alist[2] = *list;

list = &z;
alist[1] = *list;
}

else
{
list = &x;
alist[1] = *list;

list = &y;
alist[2] = *list;

list = &z;
alist[0] = *list;
}
}
else
{
if(y>z)
{
list = &x;
alist[2] = *list;

list = &y;
alist[0] = *list;

list = &z;
alist[1] = *list;
}

else
{

list = &x;
alist[2] = *list;

list = &y;
alist[1] = *list;

list = &z;
alist[0] = *list;
}

}

cout << alist[0] << endl;
return 0;

}

>>
File: C - Boilerplate Free.png (1MB, 328x866px) Image search: [Google]
C - Boilerplate Free.png
1MB, 328x866px
>>
>>57107011
>int alist[2];
Here's your problem.
>>
>tfw two intelligent for archaic languages like c
>>
>>57107083
god damn it, should be alist[3]. Ty anon, I fucked myself over by thinking [2] was 0-2.
>>
>>57107011
>>57107183
why are you doing
list = &x;
alist[0] = *list;

instead of
alist[0] = x;


And you haven't actually solved the problem in accordance with the problem spec. You haven't created the function with the specified parameters.
>>
>>57107081
#include <stdio.h>
#include <string.h>

typedef enum {
ERR = -1, a, b, c, d, f, h, cat, rat, pot, END,
} stuff;

static const struct { char *value; char *image; } stuff_table[] = {
[a] = { "a", "A" },
[b] = { "b", "B" },
[c] = { "c", "C" },
[d] = { "d", "D" },
[f] = { "f", "F" },
[h] = { "h", "H" },
[cat] = { "cat", "CAT" },
[rat] = { "rat", "RAT" },
[pot] = { "pot", "POT" },
};

char *image(const stuff i)
{
return (i >= a && i < END) ? stuff_table[i].image : NULL;
}

stuff value(const char *str)
{
for (stuff i = a; i < END; ++i)
if (strcmp(stuff_table[i].value, str) == 0)
return i;
return ERR;
}

int main(int argc, char *argv[])
{
for (stuff i = a; i < END; ++i) {
char *str = image(i);
if (str)
puts(str);
}

stuff pos = value("cat");
if (pos != ERR)
printf("%d\n", pos);
else
puts("ERROR");
}
>>
>>57107219
idk, first time using pointers. :>
As for the problem, I think I've finished the functionality of it. Are you saying this wasn't what the problem was asking?
>>
why are octal digits used?
>>
>>57107301
You've done the functionality of it, albeit in a very inelegant brute force way, but you haven't done the function.

You should open up your literature at read up on what a function is.
>>
>>57107321
Women think in Octal
Trannies think in Decimal
Real Men think in Hex
>>
>>57107268
>value("CAT");
>ERROR
>>
>>57107367
I think in binary.
>>
Do any of you use emacs? If so can I get some help trying to configure it?

I want to turn off all its stupid indentation bullshit and bind one shortcut to indent either the current line or the current selection.
>>
>>57107372
The original code had the same problem. I was trying to reproduce its behaviour.
If you're fine with non C standard (but POSIX standard) functions, use strcasecmp.
>>
>>57107268
segfaults if it's not ordered
>>
>>57107469
>segfaults if it's not ordered
What's not ordered? Where does it segfault?
>>
>>57107352
Is that better?


#include <iostream>

using namespace std;

void q9_sort(int x, int y, int z, int*list, int alist[3])
{
if(x>y)
{
if(x>z)
{
list = &x; //X is Pos. 1, Y is Pos.3, Z is Pos. 2
alist[0] = *list;
// cout << alist[0] << endl;
list = &y;
alist[2] = *list;

list = &z;
alist[1] = *list;

}

else
{
list = &x;
alist[1] = *list;

list = &y;
alist[2] = *list;

list = &z;
alist[0] = *list;

}
}
else
{
if(y>z)
{
list = &x;
alist[2] = *list;

list = &y;
alist[0] = *list;

list = &z;
alist[1] = *list;

}

else
{

list = &x;
alist[2] = *list;

list = &y;
alist[1] = *list;

list = &z;
alist[0] = *list;


}

}
}



>>
How do you guys plan a programming project?

It's a retarded question. I've been teaching myself programming for about a year now, and I simply don't know how to translate an idea into code. What functions/classes to write? How they should interact with each other? How to plan the whole program flow?
Everything seems to make sense to me before I start typing, but I always end up writing unreadable garbage.

Does anyone know a book or something on the matter? I don't even know how to search about this topic.
>>
>>57107537
Yes. But the spec only specifies four parameters. Do you really need five?

And have you tested it so that it works?
>>
>>57107556
seconding this
are there no books that work out and guide you through a project?
>>
>>57107556
people ask this all the time. i'm sure there may be a book on it but i think most people just learn from experience
>>
>>57107506
if the enum isn't in order, from 0..Z, but rather 0..W, X..Z. The for loop compares str to NULL. Also
typedef enum {
ERR = -1, a, b, c, d, f, h = 7, cat, rat, pot=2000000000, END,
} stuff;

has a pretty amusing effect
>>
Java quick question.

public boolean checkAnswer(String response)
{
double newResponse = Double.parseDouble(response);
double newAnswer = Double.parseDouble(answer);

return (Math.abs(newResponse - newAnswer) <= 0.01);
}


When I check for 1.01 + 1.02, and answer is 2.03 , why is it that 2.04 isn't considered true? 2.02 is true and 2.039 is true, but as soon as its 2.04 which I'd consider still true, is false. Any idea why?
>>
>>57107556
Make a dysfunctional prototype over the weekend, sleep on it, then come up with a design that won't collapse in on itself.
>>
>>57107610
Wow, you're fucking stupid.
The code obviously relies on the well-defined semantics of enums, so of course it fucking breaks if you change that.
As it was though, it was completely safe and portable.
>>
https://www.livecoding.tv/evdel/

please rate my waifu
>>
>>57107656
that's completely legal enum semantics, no need to get defensive. Have fun with for multi gigabyte data structure.
>>
>>57107663
>javascript
-10/10
>>
>>57107556
>>57107591
Robert Martin, Clean code: a handbook of agile software craftsmanship.
Might be something.

But it does take experience to know how to structure your code. It's a craft. You just solve problems and then think about what you would have done differently if you had to do it form scratch again. And trying to keep one eye towards writing code that's not a complete nightmare to adapt if the problem specs would change.
>>
>>57107685
Yes, a fucking lookup table doesn't work well for sparse data, but we weren't dealing with sparse data. enums by default are packed tightly, so it works very well for those.
You're just bringing up irrelevant and retarded shit.
>>
can your language do this
 fibs = 0 : 1 : zipWith (+) fibs (tail fibs) 
or this
 map (map p2) [ [x | x <- [1..9]], [j | j <- [90..120] ] where p2 = (+2) 
or this
 map (\f -> f 2 3) [ (+), (-), max, min ] 
and even this
 rev = foldl (flip (:)) [] 
checkmate!
>>
>>57107720
thanks this will be useful for my job computing fibonacci numbers
>>
>>57107720
wow... now I see the light!
>>
>>57107720
printf("zippitydippityflip");
>>
>>57107720
no, my language is actually readable.
>>
>>57107743
t. javafag
>>
>>57107706
> my implementation works as long as you don't use all the features of the language
seems poorly thought out
>>
>>57103755
Cpound-sign
>>
>>57107585
well the question asks to place it in an array. The issue is it wants it returned in ascending order, but it needs the function to be void. Would having it in the array from index 0-2 with lowest to greatest be enough. Ahh then I need to reorder everything anyways. :>
>>
>>57107761
Sea Hash?
>>
>>57107743
>I don't understand the syntax, therefore it's unreadable
>>
>>57107706
Not that guy, but i don't think sparse enums are irrelevant. It happens all the time in real worl applications. Especially when the enum represents bitmasks.
>>
>>57107757
>seems poorly thought out
Indexing with enums literally appears as an example for designated initialisers in the standard.
Yes, it doesn't work well in all circumstances, but most features don't.
You're in control of the fucking code. If you need sparse enums, don't do this, otherwise it's an extremely efficient way to lookup values.

>>57107778
As I said above.
>>
>The issue is it wants it returned in ascending order
>Would having it in the array from index 0-2 with lowest to greatest be enough
I don't even. This is literally what ascending order means.

>>57107777
That's pretty much the definition of unreadable.
>>
File: 1465441404525.gif (2MB, 320x287px) Image search: [Google]
1465441404525.gif
2MB, 320x287px
Does anybody have any idea as to why in C# a WebClient would be able to load images, while the exact same request formatted into a HttpWebRequest would return 403s?
>>
>>57107829
I wasn't sure if that was enough. :S
>>
>>57107699
>>57107650
>>57107595
Thanks, will take a look a that book. But the catch is that you'll end up writing shitty code until you get good at it?
>>
>>57107857
What more could it possibly mean? I don't understand your thinking here.
>>
>>57107857
Stupid naruto shitposter
>>
File: DeepinScreenshot20161017024748.png (152KB, 1014x559px) Image search: [Google]
DeepinScreenshot20161017024748.png
152KB, 1014x559px
>>57107663
Ok so I checked out this website, went into java category, and level expert.
And literally the first entry waspic related.
I think I know why you guys hate java so much...
>>
>>57107812
Here's a sparse enum for you :^)
typedef enum {
ERR = 2000000000-1, a = 2000000000, b, c, d, f, h, cat, rat, pot, END,
} stuff;
>>
>>57107884
Well, in practice the middle of your life is around 12 years old if we assume humans perception of time exponentially decrease over time
>>
>>57107873
>you write shitty code until you get good enough to not write shitty code
Well... yeah.

You gotta constantly and actively work on doing better.
>>
>>57107874
the question says to return the value into "list". I'm not really returning I think, but rather changing the values from null to whatever.

Anyways, I'm doing this question now. How hard is that from the previous?
>>
>>57107919
Well... no

Take a sheet of paper and start using your brain you faggot
>>
>>57107930
Hoo, big man
Why are you so angry at anon? He's right. You write shitty code until you get better at programming, at which point you are capable of producing a better result. If all you know are if statements and loops, the upper limit of your code quality is low. The more stuff you learn pertaining to programming as a concept (and the language), the better code you are capable of producing.
You don't learn how to program by taking a best practices class, reading a bunch of books on programming, and then jump right into making professional quality programs.
>>
>>57106110
I dont know but I want to.
>>
>>57107930
You're saying you can write good code before you're good enough to write good code? Are you literally retarded?
>>
File: DeepinScreenshot20161017030112.png (47KB, 1038x840px) Image search: [Google]
DeepinScreenshot20161017030112.png
47KB, 1038x840px
>>57107918
If average life span is 48 years then you're right.
>>
>>57106110
they're organized into blocks of 6 decimal digits. look up cyphers that use that
>>
>>57107367
Autists dream in Code
>>
>>57107987
>exponentially means quadratic
>>
>>57107987
>exponential
>>
>>57107985
>you can write good code before you're good enough to write good code
So you never write good code then?
>>
>>57107556
Using flowcharts is pretty helpful. You can draw them yourself or find software that does
>>
File: Hinatalaughing2.jpg (13KB, 400x300px) Image search: [Google]
Hinatalaughing2.jpg
13KB, 400x300px
>>57107882
Is there a problem anon?
>>
>>57107764
Coctothorpe. Pronounced see octothorpe
>>
>>57108057
ASCII flowcharts are freaking cool to put them in the source code

This is one that does that but their are more:
http://asciiflow.com/
>>
>>57108090
what
>>
>>57107987
The function for perception of a year would be 1 / total years, not year ^2

I'm actually curious now, can someone calculate this? I'm not exactly sure what the math to use here would be. I figure that it would be summation followed by division but I'm not certain
>>
>>57108090
>ASCII flowcharts are freaking cool to put them in the source code
Fuck no anon
Tell me you don't do this
>>
>>57108072
Yes. This board need a harder capatcha with complex mathematical formula to solve so it could filter out normies for good.

Also, old hinata is terrible taste. She was much better as a loli.
>>
>>57108134
Why the fuck not?
>>
I got a legitimate question.
Why would I ever (in the modern circumstances) want to choose C over C++?
From what i know C++ can do everything C can and much more.
Am I missing something?
>>
>>57108144
Flowcharts are for planning, not for implementing. Also, since flowcharts inherently reference a ton of things, unless you're copying and pasting the same chart all over your code it's not actually that useful- and if you do that, you get a ton of bloat.

Why not just use your language's inbuilt _docs?
>>
>>57108090
If you are the anon who is asking how to organise projects I would not recommend that. If not, no.
>>
>>57106000
>>57106123

The gamedev industry hires a lot of programmers for performance-critical shit in C++. Too bad the jobs all suck because anything to do with videogames is a "dream job" and therefore employers can shit on employees and get away with it.

Maybe do rendering stack shit for Dreamworks or Pixar since I THINK that isn't hell?

Anyway, what I'm saying is, if you hate webdev but still want job security, learn you some 3D rendering skills.
>>
>>57108134
>>57108188
b--but... why?
>>
>>57108160
If you're programming microcontrollers or other low-level things, like driver software
>>
>>57107720
All of these are pretty quickly understood if you have a working knowledge of Haskell.

The first example generates an infinite (lazy) list of the Fibonacci numbers starting with 0, 1.
The second example is easily reduced to:
map (map (+2)) [[1..9], [90..120]] = [[3..11], [92..122]]

The third applies 2 and 3 to each of the functions in the list, giving:
[2 + 3, 2 - 3, max 2 3, min 2 3] = [5, -1, 3, 2]

The fourth is a simple point-free list reversal function.
>>
>>57108177
>language's inbuilt _docs
>>
>>57108211
>>57108177
>>
>>57108160
Also, OOP is a neurological cancer that need to be eradicated

>First religions, now this. When will you learn?
>>
>>57108221
What's funny anon :^)
>>
>>57108160
If your target platform doesn't have a C++ compiler.
>>
>>57108177
but how am I supposed to add loli ascii porn in my code so I can fap while programming then?
>>
>>57108212
Why can't you use C++?
>>57108231
But you don't have to use OOP. From what I understand at least. You can just code like in C, but with all the good features like templates and stuff.
>>57108238
But how often is that the case situation in, again, modern circumstances?
>>
>>57108215
To clarify the reduction in example #2:
map (map p2) [ [x | x <- [1..9]], [j | j <- [90..120] ] where p2 = (+2)
= map (map (+2)) [[1..9], [90..120]]
= [map (+2) [1..9], map (+2) [90..120]]
= [[3..11], [92..122]]
>>
>>57108258
C runs with less memory, and it doesn't require anything like the C++ redistributable
>>
>>57108258
>good features
>template
Hmmmm no thanks.
>>
>>57107829
>I don't understand typedef struct bar {Int bar;} bar;
>therefore its unreadable universally
>>
>>57108290
Templates are a good feature that can be abused. You know what else is a good feature that can be abused? Pointer arithmetic.
>>
>>57108302
Pointer arithmetic makes sense. Templates does not.
>>
>>57108312
What doesn't make sense about templates?
>>
>>57108215
thank, you
these fags think that
something like
 foldl (*) 0 

is unreadable just because they're not familiar with haskell

its like saying C is unreadable because I don't understand
 char (* lmao)[50]
>>
>>57108318
You can not predict its behavior per se
>>
>>57108285
>C++ redistributable
I thought it was only a visual studio thing, wasn't it?
>C runs with less memory
C'mon, what numbers we are talking about here? Is it even noticable difference in >modern< settings?
>>57108290
The point is that you have many features that C++ offers, and you don't loose anything from C.
And don't tell me that having experience programming with both C and C++ you actually don't appreciate many of C++ features, I don't believe that, even if you're a firm OOP hater.
>>
>>57108211
Do it if you want. I don't care enough to explain why that could be counterproductive.
>>
>>57108344
Are you saying that code generation through templates is non-deterministic?
>>
>>57108350
>C'mon, what numbers we are talking about here? Is it even noticable difference in >modern< settings?
MICRO
CONTROLLERS
>>
>>57108350
Unnecessary bloating is what's killing this world. Simplicity is the only utter end to everything.

>>57108366
No, I'm saying it requires too much brain time to be used efficiently. C is art, C++ is just another tool.
>>
>>57108418
>Unnecessary bloating
Why don't you code in Assembly?
Or is it too bloated?
Let's code straight in binary
>>
>>57108418
Templates are basically safer and higher-level macros so I don't know how they can possibly require more "brain time" than the C equivalent.
>>
File: smh_tbh_fam.gif (490KB, 500x671px) Image search: [Google]
smh_tbh_fam.gif
490KB, 500x671px
>>57103514
>tfw one of your classes hits 1200 LOC
Welp, guess I'll learn about metaprogramming.
>>
>>57108204
the professor for my software development 1 class related one day that he used to want to be a game developer, but he got fed up with the terrible pay and conditions and quit. this massive douchefaggot with retarded video game tattoes who i fucking hate butted in "oh but the triple A guys make bank, the call of duty guys? those guys make bank." it'd satisfy me to no end if he tried to be a video game developer
>>
File: 1456959677937.jpg (2MB, 1100x1500px) Image search: [Google]
1456959677937.jpg
2MB, 1100x1500px
>>57107630
ANYONE?
>>
>>57108483
you're doing minus
>>
>>57107630
floating point bullshit
>>
>>57107630
Use fixed point loser
>>
>>57108554
>>57108563
thanks, small thing but i learn from it
>>
>>57107922
Idk how to find a range of values in an array. :/
>>
File: 1.jpg (672KB, 1000x1057px) Image search: [Google]
1.jpg
672KB, 1000x1057px
I'm terminally autistic and hate to be the one asking this question, but I'm also in a bad situation.

I have a year or two before I'm homeless. I can't hold a job because of the terminal autism. NEETbucks isn't enough to live alone.

What programming language is the best to start with, what should I try to take at a local community college to help me get a steady code monkey or web dev job?
>>
>>57108683
malbolge
>>
File: 2.png (561KB, 600x800px) Image search: [Google]
2.png
561KB, 600x800px
>>57108692
>malbolge
Malbolge, invented by Ben Olmstead in 1998, is an esoteric programming language designed to be as difficult to program in as possible. The first "Hello, world!" program written in it was produced by a Lisp program using a local beam search of the space of all possible programs. It is modelled as a virtual machine based on ternary digits.
The language is named after Malebolge [sic], the eighth level of hell in Dante's Inferno, which is reserved for perpetrators of fraud. The actual spelling Malbolge is also used for the sixth hell in the Dungeons and Dragons roleplaying game.

Anon why.
>>
>>57108683
C, then move to C# and find a codemonkey job.
Also, nice biceps.
>>
File: 3.gif (2MB, 260x195px) Image search: [Google]
3.gif
2MB, 260x195px
>>57108721
Thank you anon appreciate it. Off to the sticky I suppose.
>>
>>57108880
Spooky. :>
>>
>>57108464

Or just learn how to refector.
>>
I'm a self-taught piece of shit. How do I into programming job, without a degree?
>>
>>57108908
Or just learn Haskell
>>
>>57108912
You don't.

Not without connections, anyway.
>>
>>57108908
I don't think this class has too many responsibilities to do a refactor, it's just that there's a lot of repetition in the "pumbling" (properties doing the same shit that can't be encapsulated) so I thought it would be nice to learn that.

>>57108912
See >>57108721
>>
Your boss walks in and assigns you to a project written in PHP - one which is 12 years old and full of weird arcane workarounds. It may have originally been a weird riced-out Drupal CMS site that got hacked a lot over the years into an unrecognizable monstrosity. The specific assignment you have is to "make it more Web 2.0" and integrate it with social media.

What do you do?
>>
>>57109011

>it's just that there's a lot of repetition
Refactor.
>>
>>57108464
nigga what are you saying
>>
>>57109186
For example I have several properties with the form of:
public string Day
{
get { return _selectedDay; }
set
{
if (_selectedDay == value)
{
return;
}

_selectedDay = value;

OnPropertyChanged("Day");
}
}

They just change in the name, type, and the backing field, so it would be baller if all those properties were autogenerated (including the functionality).
>>
size_t findminpos(int arr[], size_t len)
{
size_t index = 0;
size_t i;
for (i = 0; i < len; ++i)
if (arr[i] < arr[index])
index = i;
return index;
}

Why does this only ever return 0? As far as I can tell, my logic is sound
>>
How do I learn the entire Java programming language in the next hour?
>>
>>57109410
imagine you had a mediocre language, then added tons of verbosity and OOP bullshit and enterprise on tpo
>>
>>57109410
POO
>>
>>57109445
post object object?
>>
>>57109445
IN
>>
>>57109378
it probably has something to do with the arguments being passed in
>>
>>57109469
LOO
>>
>>57103810
Martin?
>>
>>57109424
asshurt python faggot detected
>>
>>57109529
>python
lol no

try again pajeet
>>
>>57109534
god sorry, probably something even more useless... i dunno ruby?
>>
I'm trying to find the name of a concept, but I completely forgot what it's called.

What is it called when, instead of having numbers of descending size, it's ascending. For example,

Normal numbers are:
1 * 10^3 + 2 * 10^2 + 3 * 10^1

What I'm looking for is numbers listed like:
3 * 10^1 + 2 * 10^2 + 1 * 10^3

so 321 instead of 123
>>
>>57109575

Looks like a base-10 sort of little endian.
>>
>>57109575
this is confused the shit out of me, are you perhaps trying to refer to endianess?
>>
File: Untitled.png (66KB, 640x400px) Image search: [Google]
Untitled.png
66KB, 640x400px
I'm trying to write an OpenGL shader that will draw a box between one vertex to the x value of the next.
This is essentially drawing a histogram/bar chart, like the attached picture (where the red dots are my vertices).

I know I'm probably supposed to use a geometry shader, but I don't really know how I'm actually supposed to do it.
>>
>>57109606
>>57109615
>little endian
Yep. For some reason I kept thinking of "big/little Euclidean" Thanks, brahs
>>
>>57109624

https://open.gl/geometry
>>
>>57109643
I don't know how to get the next vertex from inside a shader though.
>>
File: 1455728208069.jpg (9KB, 298x169px) Image search: [Google]
1455728208069.jpg
9KB, 298x169px
>>57103514
I need some data structures advice for a personal project, please.
I need to store some interpreting information in named columns/fields.

Then I must create a 2D table. Think in a SQL table but much less complicated.
- I want to constantly add or remove rows.
- Column/field adding and removal is much more uncommon.
- Each column/field have one consistent type.
- I want to make random access to its elements as fast as possible.
- I want for columns to have a name and identify them using something like a hash table.
- I want to access items using something like table[row_number] or table[row_number][column_name]
- I want to grant elements to have the possibility to have a "Null" value, different to zero.
- Column/field amount and typing is defined by the XML file, it needs not to be hardcoded.

So far I had no problems by representing this data structure in an XML file, so at least I know how to store it.

I'm doing this in C++. C++11 allowed.
>>
>>57109640
np, think byte ordering. is the most or least significant byte of the word stored in the lowest address of the word?
>>
>>57109653

you mean generate it?

well it would input v1 and v2, then generate v1(x),v2(y) and v2(x),v1(y)
>>
>>57109671
you could try some sort of a hash table where the hash function uses some combination of the row and column name?
>>
>>57109700
Looking at my little picture, say I'm at the first red dot.
How do I find out where the second red dot is inside the shader?
It would be nice not having to change how shit it passed to my shader, but if that's what I have to do, I suppose I'll have to.
>>
why does using an array containing the left values and using the array containing the right values give me different results when rendered with OpenGL?

The only difference is type. One I had to malloc myself, the other was copy pasted from a .obj file.
>>
>>57109671

csv

it is literally done like this in a text file:

[data],[data],[data]
[data],[data],[data]
...


Then you will be able to open in Libre Office Calc or excel if you are a cuck
>>
in C++
bp1 = nbag_rate;
I have pointer bp1 with an address, can I point bp1 to a new address on the spot?
like
int val = 2;
*bp1 = &val;

or do I have to first set it to null?
>>
>>57109941
oh nevermind, I just had wrong syntax

*bp1 is only used as a constructor when its initialized, otherwise it will derefence

bp1 = &val; did it

* and & have so many meanings damn, why not use other symbols
>>
File: ewuhvbna.jpg (317KB, 960x947px) Image search: [Google]
ewuhvbna.jpg
317KB, 960x947px
>>57103514
Familiarizing myself with SDL. Trying to come up with some kind of ideas worth pursuing to try and build a portfolio so that I'm not fucked when I graduate. It's not going so well at the moment.
>>
Any nice calming ambient songs to listen to while coding tonight?

https://www.youtube.com/watch?v=dM6lFQysxtg
>>
>>57110286
https://www.youtube.com/watch?v=1NkZVWXK5jM
>>
What are some essential skills a Python programmer must have?
>>
>>57110346
none
>>
>>57110346
Declaring variables
For/while loops
Math
>>
>>57110342
Listening to it, sounds good so far. Thanks!
>>
File: 1471532996287.png (272KB, 471x325px) Image search: [Google]
1471532996287.png
272KB, 471x325px
So I'm sorry if this is a dumb question but
I have 0 idea to code and want to start trying to learn how to. One thing I kind of wanted to start out doing was this one idea I had for a script or something that would change every instance of a specific word (i.e. someone's name in an irc log) to something else, such as "redacted".
I'm not asking to be spoonfed or have you guys do it for me, I was just wondering what specifically should I look up how to do so I could make that?
>>
>>57110444
You probably want to look into a scripting language. Those can be written up relatively quick and can do what you're asking for. Also simple find all replace works too.
>>
>>57110516
Thanks, anon. Any recommendations on a particular language for that or would any scripting language work just fine?
>>
What is the point of constant reference that is set to a literal in C++?
>>
OP didn't put a link to the new thread in here, for some reason:
>>57110498
>>57110498
>>57110498
Thread posts: 319
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]

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.