[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 - Procedural programming edition

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: 326
Thread images: 29

File: dp2.png (503KB, 940x822px) Image search: [Google]
dp2.png
503KB, 940x822px
What are you working on /g/?
>>
First for me
>>
Do you guys like dynamic programming?
>>
>>57652663
It's pretty neat
>>
>>57652635
What are your thoughts on ABAP /dpt/ ?
>>
>>57652663
no
>>
>>57652635
>Procedural programming edition

is this bait
>>
>>57652663
I'm dumb. I won't magically stop being dumb.
Can somebody link me a good guide on this?
>>
>>57650346
>If you shave and wear a suit jacket and shirt I promise you're already above 95% of their candidates. I'm pretty sure that's the only reason I have my job, they even mentioned that others solved their interview test in a much cleaner fashion so I assume the reason they didn't go with those guys is they were neckbeard spergos.

What if the office is business casual? Wear a suit anyway?
>>
Why can't c++ do basic things like average 2 ints?
>>
>>57652777
I always just ask before the interview what they expect me to wear. Sometimes they answer like it's obvious, but different companies expect different things.
>>
>>57652814
What do they generally expect? 99% of the professional devs I see are wearing slacks/khakis and a button-down shirt, is that the norm?
>>
>>57652809

Hehehehehe. I remember that shitstorm.
>>
>>57652809
Even allocating memory is hard with C++.
>>
>>57652831
People will sometimes dress up for interviews even if they don't expect to wear the same outfit during business hours. Not everyone in every field does that.
>>
>>57652635
if(op.image.isNotXKCD() == true)
{
reply("Please post an XKCD image next time");
}
>>
>>57652809
int
avg(int a, int b)
{
if ((a < 0) & (b < 0))
{
return a/2 + b/2 + (a%2 + b%2)/2;
}
return (a+b)/2;
}
>>
>>57652869
if (post.poster.isFaggot() && true)
{
{
reply("faggot");
};
}
>>
dicks :: Integral t => t -> String
dicks n = "8" ++ shaft n ++ "D" where
shaft 0 = []
shaft n = '=' : shaft (n-1)
>>
>>57652831
Maybe yeah. It depends where you apply. I did an interview once at some company that did some kind of business software stuff, i forgot to ask what to wear and dressed smart casual. During the interview everyone dressed smart casual too, but at the end they asked me why I didn't wear a suit. Felt dumb. Didn't get the job.

So yeah. I would just ask if I were you.
>>
>>57652777

I've heard both ways. Here's what I think it *really* boils down to: if you're already in the top couple spots in the candidate list, and you dressed better, they'll tend to chose you.

I've interviewed so many people who come in wearing nice suits and have *no fucking clue* how to program that I'm immediately suspicious when I see one. I'm not being some code snob and saying a guy who doesn't know some arbitrary algorithm off the top of his head sucks, I'm saying guys who literally don't understand how to write a for loop when applying for a C++ position.

Two of the best hires I've ever witnessed showed up in regular jeans and rumpled polo shirts. As far as dress and presentation go, all I care about is whether the guy stinks or has other disgusting hygiene or personal habits (e.g. snorting snot into his throat, coughing or sneezing without regard for others). Just wear clean, presentable clothes (i.e. no pizza grease stains) and I'm set.

That said, a good friend who has worked for many well-respected games companies insisted that wearing a suit gets him jobs. But he's quite literally one of the most intelligent and talented people I know, so I think he's full of shit on the suit thing.
>>
>tfw after fucking seeing all this propaganda about Haskell, I'm actually thinking of learning that meme language.
>>
File: ddd.jpg (195KB, 800x450px) Image search: [Google]
ddd.jpg
195KB, 800x450px
What's the difference between POP and OOP?
>>
>>57652867
I have two interviews. One is for a small insurance company and one is for a small startup. Both jobs are for mobile dev (junior developer)

should I just ask what to wear or show up in a suit?
>I can't afford a good suit atm
>>
File: nodejs.png (24KB, 500x500px) Image search: [Google]
nodejs.png
24KB, 500x500px
Why don't you use node.js?
>>
>>57652858
no its not
>>
>>57652831

Most software engineers I've worked with wear jeans or shorts and t-shirts. A collar is weird.

The last job I had in San Francisco, a guy at the interview was barefoot. That place was super relaxed. One guy got sent home by HR for ironically wearing 70's short-shorts.
>>
>>57652906
feel free to ask for help
>>
>>57652890
replicate
>>
>>57652923
"anon we need to use Spring and JSP because these technologies are stable and well-documented and also I need java as a crutch"
kill me now 2bh
>>
>>57652922

I would suggest wearing a dress shirt, no tie, top button unbuttoned, with dress slacks (flat front, no pleat), a belt, and dress shoes (not high gloss shine). That's your run of the mill "dressed a little nicer than the job should ever require" level.

Personally, I like Express shirts. For pants, look for a wool blend. I don't personally like all-synthetic pants. You should be able to find a decent pair for $20 - $40.
>>
>>57652777
Always dress one level above
If they're in formal suits, you wear a tuxedo
>>
>>57652940
Where is the functional programming paradigm actually used other than posting meme solutions of FizzBuzz?
Not bait, I'm genuinely curious. Also, good resources to start?

I know C, Java, a little C++, Python (but don't know how to do stuff the `Python-way').
Also, I know some basic lambda calculus but I don't know if that'll be useful.
Basically I'm not new to programming so I don't want start from the very basics.
>>
>>57652869
>>57652884
if ((drake is cool == true || true    ) && (1 << 4)) {
printf(POST DRAKE MEME)
>>
>>57652968
is that one of the annoying ones limited to Int ? I don't want to restrict my dick to only 9223372036854775807.
>>
File: 1356820388509.gif (935KB, 280x280px) Image search: [Google]
1356820388509.gif
935KB, 280x280px
>>57652979
>tfw overestimated their powerlevel and walked in in a tux and bowtie while the interviewer was wearing a hoodie and shorts
>>
>>57653002
Solution: Stripper tuxedo that you can rip off with one hand with slightly less formal wear beneath it
>>
>>57653002
Don't forget the fedora
>>
>>57652926
Show me how you allocate 3 foo (foo is a class)?
>>
>>57652809
C can do basic math and averaging ints is basic math so C can average two ints. So can C++. The only thing that might not be able to is you, can you anon?
>>
>>57653002

Overdressing is way better than underdressing. If a company judges you for overdressing, you shouldn't be there working there IMO.
>>
>>57652988
It's not used in very many places sadly, but it's slowly being worked into imperative languages

https://wiki.haskell.org/Tutorials

>I know some basic lambda calculus
that's very useful
>>
>>57652935
>a guy at the interview was barefoot
And you didn't turn 360 degrees and walk out?
>>
>>57652635
What anime is this from?
>>
>>57653021
Not sure what you're asking but
vector< foo *> v(3);
for (int i = 0; i < 3; i++) {
v[i] = new foo();
}
>>
File: D.jpg (42KB, 512x512px) Image search: [Google]
D.jpg
42KB, 512x512px
>>57653036
Dvangelion
>>
>>57653029
>If a company judges you for overdressing, you shouldn't be there working there IMO.

Dude, companies will judge you for the stupidest shit in the world. Quite literally, most tech interviews boil down to "find any reason to call this guy an idiot" and the criteria for that is generally along the lines of, "is there any single thing I know that he hasn't heard of?"

I'm not kidding about this. Your manager will demand that you write a paragraph explaining why you're rejecting someone. Why? Because they know that 80% of the time it's because they lied about their experience, but the other 19% of the time you're rejecting for something that could cause a lawsuit. Age is a huge one. They need you to find any and all reasons to reject to cover their asses in the event that they're sued.

So, yeah, "bad cultural fit" because you're a try hard who showed up in a suit is most certainly a reason to be eliminated from the candidate pool.
>>
>>57652907
Letter indices.
>>
ive been coding two weeks now i made a reusme script hta applies to tjobs for me.

i want to build a bit torrent client but i have no idea how one works? what is my step how does someone build software that tehy don't know how works?

i started messing with socketsbecause i know network programming is entirely involved.

i started messing with sockets but don't spoil the software for me i want ot figure out just kinda give me motivation ;)
>>
I want to learn java and i'm going with eclipse for an IDE, but there's so many versions.

>Eclipse Neon (4.6)
>Eclipse Mars (4.5)
>Eclipse Luna (4.4)
>Eclipse Kepler (4.3)
>Eclipse Juno (4.2)
>Indigo Packages
>Helios Packages
>Galileo Packages
>Ganymede Packages


Which version of eclipse should I download? I'm tempted to just get the java EE Neon version because it's the newest, but the others have way more downloads
>>
>>57653085
>resumebot
What places do you apply to?
I'd like to make this too.
>>
>>57653065
*Tips fedora*
M'lday
>>
>>57653078
 diff POP OOP
1c1
< POP
\ No newline at end of file
---
> OOP
\ No newline at end of file
>>
>>57653085
>reusme script
>tfw I didn't think of this
which service does it use to apply?
>>
why don't programming languages use more UTF symbols that are common in mathematics?
>>
>>57653085
Use a library like libtorrent, famalam.
>>
>>57653102
requires UTF encoding
>>
>>57653021
Foo f;
Foo ff;
Foo fff;


Done, space for 3 Foos allocated
>>
>>57652997
genericReplicate, then
>>
>>57652881
>rounding down
>>
>>57653102
A lot of languages don't require compilers to support UTF-8 because muh ease of implementation or some shit. So you can't require compilers to implement support for symbols they're not required to implement support for.

I mean shit C still supports trigraphs right?
>>
>>57653092
>>57653101
 def find_email(self, response):
data = response.xpath('//body[@class="posting"]')
for i in data.xpath('.//li/p[@class="anonemail"]/text()'):
email_address.append(i.extract() + '\n')
os.chdir('/home/eedee')
email_file = open('email.txt', 'a')

if len(email_address) >= 1:
for i in email_address:
if i in l:
continue
else:
email_file.write(i)
l.append(i)


it scrapes craigslist for emails based on location and job type then another scrip sends emails to the scraped emails. i can only mine five emails at a time though because craigslist will through capchas if you start requesting too much. the email scrip actaully uses files/lists to make sure not apply to the same email wtice.

scrapy
smtp

are the libraries i used but you could do it with tons of libraries and tons ofdifffernt sites.
>>
>>57653133
Good idea, thanks
>>
>>57653103
ill ook into it but im writing it for python ;-;

it can help me understand hte bitorrent protocol though which is what in eed to get in the python
>>
>>57653160
https://pypi.python.org/pypi/python-libtorrent/
>>
>>57653133
Have you gotten any interviews through botting?
>>
Is there a way to use the DOM with requested webpages using node.js? Not a fan of cheerio desu.
>>
>>57653102
>>
>>57653231
Lost
>>
>>57653052
>typical C++ code monkey
You do not know the diff between allocating and initializing.

Bad C coder went on C++.
Good C coder stay with C.
>>
>>57653102
https://hackage.haskell.org/package/unicode-prelude-0.1.1/docs/Prelude-Unicode.html
>>
>>57653075

What you said above is indication of bad corporate culture and frankly I wouldn't work at those companies.

But if you're desperate for getting that job, asking about the dress code for the interview and then appropriately wearing what fits the guidelines they give you is better.
>>
How do i interpret a byte sequence as any arbitrary data type, where the data type is given by the user during runtime?
>>
>>57653253

>mfw I have to start on a C++ job after Thanksgiving on Monday.

I just hope I don't lose my sanity developing C++.
>>
>>57653002
thats why you do a research beforehand, also call from another number and ask if you have to be dressed well or not, say you have interview coming next week (even tho its tomorrow)
>>
>>57653123
I answer here >>57653253.
>>
>>57653253
You didn't say he wasn't allowed to initialize them.

And if you really do need to allocate an object without calling the constructor (which is stupid, since the job of the constructor is to ensure the object is in a valid state - if the valid state doesn't require any action, make the constructor a no-op) you can just malloc as you would in C.
>>
>>57653088
Can someome please guide me
>>
>>57653311
You want to play it dumb.

>>57653311
>And if you really do need to allocate an object without calling the constructor (which is stupid, since the job of the constructor is to ensure the object is in a valid state - if the valid state doesn't require any action, make the constructor a no-op) you can just malloc as you would in C.
I want to allocate in the stack?
>>
>>57653327
Since you're a newb, it probably doesn't matter one bit which one you choose.
>>
>>57653343
Then use alloca.
>>
>>57653343
>I want to allocate in the stack?
Use inline assembly and decrease stack pointer by sizeof(foo)
>>
>IDE can't handle ncurses

What am I even supposed to do then?
>>
>>57653271
Call a function?
>>
>>57653383
I want the asm code to just change the pointer to stack for all the local vars. Not call a function at runtime. Why an esay task in C become difficult in C++.

>>57653388
no comments
>>
>>57653390
Don't use the IDE.
>>
File: 1421597781065.jpg (71KB, 400x388px) Image search: [Google]
1421597781065.jpg
71KB, 400x388px
I just got 2000$ insurance money, what can I buy?
I was thinking of getting an Apple laptop and a nice Android smartphone (OPO3 maybe?).

What do you guys think? I already have a decent Windows desktop and a Linux Thinkpad X230
>>
>>57653419
How do you do it in Java? It's a feature inherent in all the object oriented programming languages. If you still don't want to initialise when declaring, you can just not define a constructor and define a separate init function.
>>
>>57653464
If you haven't already maxed out your IRA contribution limits for the year, put it into a Roth IRA. Look for an unmanaged one. Something like Vanguard's target retirement funds are a good choice.
>>
>>57653464
This is a programming thread, not buyer's advice.

Also, the dollar sign precedes the amount.
>>
>>57653493
I chuckled

>>57653464
iPhone SE + cheap Macbook imo
>>
>>57653464
maybe put it in a savings account. How old are you?
>>
>>57653493
Do you contribute to both a Roth IRA and a standard IRA or no?
>t. about to enter the workforce
>>
>>57653393
So i need write function for every datype that exists?
>>
>>57653513
I'm 21, I work and save money out of every paycheck.
>>
>>57653466
No I can just stay with glorious C.
>>
>>57653527
Generate it compile-time using templates or a similar system.
>>
>>57653516
Roth if you're young, regular if you aren't
>>
>>57653542
I'm 25 and the jobs I'm interviewing for pay 50k with some benefits, first "real" job other than Starbucks. I have $0 in the bank right now.

my only expenses are rent and food

Go regular?
>>
>>57653530
Hard to see you being a good saver when you're consider blowing $2000 on a macbook when you already have a good desktop and thinkpad.
>>
>c++
>have to make a set of an enum
>want to iterate through that set (ie output it)
>can't just make an iterator like normal, is giving me errors

is there something special i have to do ?
>>
File: 1rPEkGQ.jpg (2MB, 1665x3441px) Image search: [Google]
1rPEkGQ.jpg
2MB, 1665x3441px
>>57653560
If you have $0 in the bank, maybe put it towards an emergency fund. Once you're employed, start contributing towards your retirement.
>>
>>57653541
That still means i have to manually call the template once for eath data dype.
>>
>>57653614
Understood, but does your advice on the Roth IRA being for younger people stand in my situation (given that I'm 25?)
>>
>>57653580
>hard to see you being a good saver
I literally got the money from an accident. I always wanted a Macbook (webdev and it just werks) and a nice smartphone and not a budget piece of shit.
What's wrong with buying a high end device?
>>
>>57653560
Once you get a real job, I think everyone should go see a financial advisor.
>>
>>57653641
alright, will do
>>
>>57653633
Keep doing your Roth for a while. I'm 29 and still contribute to a Roth.

>>57653641
Most financial advisors probably aren't worth the money unless you've got a shitton to manage.
>>
>>57653638
>I literally got the money from an accident.
I know

>What's wrong with buying a high end device?
Nothing if you have the money spare. Just seems like you don't have that much disposable income. Maybe I'm wrong. I wouldn't judge you so much if you were planning on selling the thinkpad at least.
>>
>>57653660
If you do go see a financial advisor, do not let him put your money in an actively-managed account. You pay more for a managed account and they rarely beat the market (i.e., investing in diverse index funds and just letting it sit).
>>
>>57653687
Alright, fair enough.
Yes, I was planning on selling the thinkpad and my current shitty phone as well.
>>
>>57653696
I'll try to remember that, thanks
>>
>>57653727
But can you really live without the USB3.0/2.0 ports, the HDMI port and such? Or maybe you're planning to buy the last year model.
>>
>>57653727
fair enough. You have my blessing to by a macbook.

Protip: I bought a second hand macbook. Came with a 1 year warranty. Was 2 years old, maybe 10% slower than the equivalent current year model and about 40% cheaper. Good option to look into if you want best bang for your buck.
>>
>made my post in the old thread
So annoying. Now nobody will see it :(
>>57653772
>>
Why is the Linux kernel written in C masterrace and not Haskell?
Checkmate, functional programmers.
>>
>>57653804
What flaws are you talking about in the STL?
Genuinely curious. I'm not a C++ developer, but I have used C++ and STL in competitive programming before.
>>
>>57653874
>competitive programming
I'm interested. Just what is this? How do they rate you?
>>
>>57653835
Parts of the Linux kernel use Haskell now. It's been part of the main branch since July.

http://lkml.iu.edu/hypermail/linux/kernel/1611.2/03882.html
>>
>>57652655
>>
>>57653641
I just kind of do nothing with my money. I make a lot and have no debt and don't really care. It's weird, I just have no desire to mess with it.
>>
>>57653906
https://en.wikipedia.org/wiki/Competitive_programming
>>
Hey guys, I'd like to get into programming, What are some good beginner guides that you personally would recommend to get on my feet?
>>
>>57653615
Generate that too with metaprogramming. Generate the entire function with the multiple codepaths.
>>
>>57653932
get into investing. It's fun.
>>
is 0 a fizzbuzz?
>>
>>65654319
>muh generics
You don't need them. Meanwhile

>easiest cross compilation ever devised
>language is simple enough to learn in an afternoon
>import libraries directly from github
>productive af
>godoc
>>
>>57653933
That's stupidly general and useless.
It doesn't test programmer productivity at all it seems.
>>57653874
Well I'm obviously speaking very generally, so I can't describe all the reasons I've heard at once but the general trend seems to be that they fall for the everything looks like a nail when you carry a hammer issue.
C++ is a language you choose when performance matters. It's a terrible language in most other ways and you're better suited picking most other things when you don't have high requirements in that area. The standard library often contrasts quite hard there. It doesn't fit your code well enough. You find that things like allocation is especially poorly done in the standard library. You can't easily end effectively pass an allocator to most of the standard library so that's a big deal when you care about performance.
D does a better job it seems. But I don't have that much experience and I haven't read enough so I can't exactly vouch for it.
>STL
It's not just the STL, to be clear.
>>
>>57654019
Yes
>>
So I got SICP and I'm kind've lost. It's all scheme so I'm trying to figure out how to run scheme code on debian, but so far all the solutions I've looked up online are either using emacs or some package that doesn't exist.
Don't really wanna use emacs because my aspire one can't really handle it but if I have to I suppose I have to.
>>
>>57654019
Yes if the range is 0-X you should print fizzbuzz for 0.

If you write your fizzbuzz in a general way there's no problem.
>>
>>57654066
>my modern computer can't handle emacs
Why is Linux devs so shit? It's a text processing tool for God's sake.
>>
Hey guys, how can i hack facebook?
>>
>>57654056
>It doesn't test programmer productivity at all it seems.
>>57654056
Yeah, it's not meant to do that. It's most for computer science (algorithms mainly) and math. Many people, including me, get a kick out of solving these kinds of problems. Essentially they are like puzzles, where you just have to find a clever solution and handle all the test cases and such.

Yeah, I agree about the hammer and the nail part. Seems interesting, thanks.
>>
>>57654085
Probably went a little hard there. It's probably RMS's fault specifically.
>>
>>57654097
Print a facebook page then hack it with a knife.
>>
Hey im a student thats in middle school and is tryina learn c++, ive made quite a progress but do u guys have any suggestions for me for the future
>>
Do they actually ask FizzBuzz in interviews or is that just a meme? Because that's just silly
>>
>>57654160
you have to be 18 to post here senpai
>>
>>57654097
Look at their bug bounty boards.
On fb/whitehat
Look at what exploits/flaws you can find in existence already. Where there's one there's usually more.
Look at their recent aquisutions. It's not garaunteed theyve had time to go find the bugs in the smaller applications of the acquired company.

It's mainly for webdevs though since by nature of the company you'd have to first get server access to search for bugs there. Which would be hard and probably illegal to poke around when you're already that deep.
>>
>>57652988
There's lots of it in finance and PL stuff.
>>
>>57654160
Well that's a very general question. I'd say you should stick with it and never settle for what you feel safe in. Don't write console applications just because they're familiar to you, head into graphic programs because they're a new challenge/something new to learn.

I'd also recommend the handmadehero.org community. They're very nice C or C++ devs and they're based around an educational stream. They're better than this place.
>>57654186
He was probably held back. I'm sure our friendly poster here doesn't intentionally break rules.
>>
File: 2016-11-23-180732_1024x600_scrot.png (119KB, 1024x600px) Image search: [Google]
2016-11-23-180732_1024x600_scrot.png
119KB, 1024x600px
>>57654085
I don't have a very strong modern system lol.
I used emacs for something like five minutes on a brand new install and it seemed to be really slow compared to vim. I mean if I have to I'll try it again but I'm seeing if I can avoid it.
>>
File: 1460310366444.png (311KB, 652x669px) Image search: [Google]
1460310366444.png
311KB, 652x669px
>>
>>57652635
>>>57654160
>you have to be 18 to post here senpai
Your probably a fat 12y/o cunt literally asking on 4chan how to install fucking minecraft mods, just kys please
>>
>>57654267
You shouldn't need a strong system. I never said that. But anything made past 2000 should run a text processing tool as long as it's compatible (software available for the OS).

Happy to see Vim fares better.
>>
>>57654318
Missed the introduction to loops obviously come on anon.
>>
>>57654267
you can pick up a refurb'd lenovo desktop with an i5 and 4gb of ram for like $200, stop using that beater anon
>>
>>57653614
>529 plan
Into the trash it goes.
>>
For the numbers 1 through 2020, do the following:
- If the current number is not divisible by 3 and not divisible by 5, print "n rupees" where n is the current number.
- If the current number is divisible by 3 and not divisible by 5, print "Poo"
- If the current number is divisible by 5 and not divisible by 3, print "Loo"
- If the current number is divisible by 3 and divisible by 5, print "Poo in Loo"
- If the current number is equal to 2020, disregard the aforementioned algorithm. You're a superpower now! Shout your pride to the skies!
>>
How could I dump some long text file into a single field of an sql table if the server is not running on my machine? I thought load_file() would work but apparently that doesn't.
>>
>>57654541
clob
>>
>>57652635
Is Visual Studio 2010 still worth the time to install? I have a 2010 Premium ISO from uni, and was wondering if I should download the newest version of VS, or check out the newer versions.

Which is the mosty comfy VS version?
>>
>>57653102
My keyboard can't type Greek
>>
>>57654267
If Emacs is running too slow, checkout the git repo and compile it with all of the optimization flags. If it takes too long to start up, start emacs in daemon mode and connect to it through emacsclient -c
>>
>>57654575
any editor worth its salt can be easily reprogrammed to have different modes or hotkeys
>>
>>57654575
There's lots of alternatives. LaTeX (i.e. type \forall and get ∀), composition (i.e. type <= and get ≤), etc.
>>
>>57654623
I can't see how this could be beneficial for the vast majority of people.

Unless you are doing something specialized like MatLab, I don't see a reason to move away from non-English characters unless you are renaming functions for another language, and that doesn't have anything to do with mathematics.
>>
>>57654340
public int Product(int a, int b)
{
if (b==1) {
return a;
} else {
return a + Product(a, b-1);
}
}

Loops shmoops. Who needs 'em. Tee hee~
>>
>>57654452
for x in 1..2020
if x % 3 != 0 and x % 5 != 0
puts x.to_s + " rupees"
elsif x % 3 == 0 and x % 5 != 0
puts "Poo"
elsif x % 3 != 0 and x % 5 == 0
puts "Loo"
elsif x % 3 == 0 and x % 5 == 0
puts "Poo in Loo"
elsif x == 2020
break
end
end
>>
>>57654452
no
>>
>>57654676
Do you not do any arithmetic or comparison at all in your programs?
>>
>>57654676
do you prefer:
1 + 2
or
add(1, 2)
>>
>>57654657
I don't think something as basic as a programming language needs to be more complicated than basic ASCII, except where the language is intended to do only specific mathematical things (R, MatLab, etc.)
>>
>>57654703
>>57654718
I meant non-ASCII characters, my bad
>>
>>57654727
Let's go with the benefit of the doubt here and say it doesn't personally benefit you. Does it make your life harder? Can you think of any actual reason not to do this?
>>
>>57654738
As long as I don't have to ever use those characters, no. However, a language that uses those characters will most likely require me to use them at some point (unless a simpler analogue exists that can be represented in ASCII)
>>
>>57654760
And if it's easy to input them then why do you care?
>>
>>57654452
Doing this Ironically for the Lulz.
module Pajeet where

pajeet :: Int -> String
pajeet x
| x >= 2020
= "I'm a super power now. Hare Krishna!"
| x `mod` 3 == 0 && x `mod` 5 == 0
= "Poo in Loo"
| x `mod` 3 == 0 && x `mod` 5 /= 0
= "Poo"
| x `mod` 3 /= 0 && x `mod` 5 == 0
= "Loo"
| otherwise
= show x ++ " rupees"

main :: IO ()
main = mapM_ (putStrLn . pajeet) [1..2020]
>>
>>57654736
for each element in setOfElements

∀x ∈ A


both are clear, one is concise.
>>
>>57654781
please don't make fun of my people!
>>
>>57654776
>And if it's easy to input them then why do you care?
Probably won't be easy, unless I memorize the Unicode characters or have a bunch of hotkeys memorized (which probably isn't hard)
Also, font support is still pretty bad on a majority of platforms
>>
>>57654781
>for the Lulz
>shit haskell
bad
>>
>>57654812
But in practice this is how it works: >>57654657
You even replied to it. It requires barely more thought (if any more) than typing out the ASCII equivalents.
>>
>>57654784
The variable names make up half of the first. If you use the same variable names, the first one is
for each x in A
>>
>>57654813
You can write Fortran in any language.
>>
>>57654824
I will agree, those ways can work fine. Font support is still bad on a lot of platforms, and I can't be justified to have to read through insanely dense paragraphs of non-ASCII letters
>>
>>57654851
Those platforms need to catch the fuck up to be honest.
>>
>>57654813
It's pretty good haskell actually, it's clear and understandable, unlike the usual
map . f >=> getArgs
line noise regularly championed by functionwankers.
>>
>>57654860
The framebuffer terminals in Linux don't support non-ASCII characters.
>>
File: l.png (121KB, 930x793px) Image search: [Google]
l.png
121KB, 930x793px
>wow GLEW is broken
>I'll just write my own proc loader it'll be easy
>>
>>57654879
My point stands.
>>
>>57654886
wt* Language is that?
sorry I'm a newb (noob)
>>
>>57654890
So are you saying that the Linux kernel itself needs to build-in the ENTIRE Unicode font set, or just pick and choose whatever it wants so this non-standard programming method can work?
>>
>>57654886
>wow GLEW is broken
Literally how?
>>
>>57654904
C++
I'm using GLFW as an OpenGL window manager.
>>
>>57654913
Ideally, yes. But why the hell would you be programming in a framebuffer terminal?
>>
>>57654936
Maybe you aren't programming, but you are debugging and running it (I would imagine somebody is going to set that character to a const and have it be printed).
>>
File: vær lige vague for en femmer.png (27KB, 446x544px) Image search: [Google]
vær lige vague for en femmer.png
27KB, 446x544px
Working on some C#. Anyone knows what's wrong here? I can't seem to figure it out..
>>
Jizzing inside of Misato. Not going so well so far, I still have three dimensions despite my best efforts.
>>
>>57654948
In that case you can basically get away with partial support, though. You don't expect to run any other program that outputs Unicode text like that.
>>
File: 5.png (395KB, 680x665px) Image search: [Google]
5.png
395KB, 680x665px
non-blocking is autistic desu
>>
>>57654781
>>57654876
>>57654813
module Pajeet where

pajeet :: Int -> String
pajeet x
| x >= 2020 = "I'm a super power now. Hare Krishna!"
| m3 && m5 = "Poo in Loo"
| m3 = "Loo"
| m5 = "Poo"
| otherwise = show x ++ " rupees"
where m3 = x `mod` 3 == 0
m5 = x `mod` 5 == 0

main :: IO ()
main = mapM_ (putStrLn . pajeet) [1..2020]

Slightly cleaner this way.
>>
Is it true that can't use something like Qt with C?
>>
>>57654961
JUST
>>
>>57654974
Non blocking is important anon.
>>
>>57654969
Sure you can get away with it, but the non-standards compliance of it sounds terrible. Also, I would imagine there is a lookup table that maps the ASCII character with the graphic, and Unicode throws that all off
>>
>>57655004
You can't use a c++ library with C unless you fuss a little. Yes.
>>
>>57652635
is it programming if you're using other peoples libraries.

it feels kinda like just putting things together with no work. i might just do some things to scratch as a materr of chalelnge.
>>
>>57655056
That depends on what you are doing. As long as you don't copy and paste from Stack Overflow, you are doing it right
>>
>>57653917
What does that link have to do with Haskell?
>>
>>57655088
well i definitely don't do that kek.

the thing is though it's like create this object

object.send
object.do
object.tellmewhattodo
object.dontsaynomore

it's like really? i just made somehting awesome but like 95% of the work was done for me
>>
>>57654876
stop talking shit about
>=>
it is literally the greatest operator that ever was or will be
>>
>>57654916
GLEW 2.0 has some problems.
It breaks all the pre-GL 2.0 functions.
>>
>>57654876
(>=>) is really simple though. It's just a simple variant of regular function composition (.).
>>
>>57653327
Always go for the latest working. In this case, Luna. Neon has a shitty installer.
>>
>>57654056
c = obsidian knife when you need something that'll cut cheese
>>
>>57655114
It's alright, it's like the difference between building a nightstand with screws, screwdriver, the necessary wood parts, and IKEA manual vs building a nightstand with an axe and a tree.

I use pre-written code for work because I need to meet deadlines, otherwise I enjoy writing things from scratch
>>
>>57655232

Why wouldn't I use one to cut cheese? Heck, I'll even use one to spread cream cheese on my bagel or to cut butter like a butter knife.
>>
>>57655259
>implying the IKEA manual helps anybody
>>
>>57655114
What did you make?
>>
why is /g/ so stupid?
#include <stdio.h>
#define SIGN_MASK 0x0000000100000000

int main(){

int a, b, c;
long c_temp;
scanf("%d %d", &a, &b);

c_temp = (long)a + (long)b;
c = (c_temp / 2) +
(c_temp & 1) -
(((c_temp & SIGN_MASK) >> 31) * (c_temp & 1));

printf("%d\n", c);
return 0;
}
>>
>>57655412
>#include <stdio.h>
it's studio.h
>>
So in C, using chars, I want to load a file and then store the name of the file, but just the name of the file itself.

txr->texture = loadimage ( "./DATA/TEXTURE/testimage.png" );


but I want to set a
txr->name
to the "testimage" seen in the earlier pseudo.

Is there a function that lets me cut out the first part and latter part?
>>
File: wf4.png (87KB, 1259x1076px) Image search: [Google]
wf4.png
87KB, 1259x1076px
My Forth compiler is coming along nicely.
Compiling loops and branches works now (very naive code, when I get to optimizing I will get the loop counters in registers).
This is the code generated for foo:
40C000 | 48 8B 0B           | mov rcx,qword ptr ds:[rbx]
40C003 | 31 D2 | xor edx,edx
40C005 | 48 0F BA EA 3F | bts rdx,3F
40C00A | 48 31 D1 | xor rcx,rdx
40C00D | 48 29 C1 | sub rcx,rax
40C010 | 48 F7 D9 | neg rcx
40C013 | 51 | push rcx
40C014 | 50 | push rax
40C015 | 48 8B 43 08 | mov rax,qword ptr ds:[rbx+8]
40C019 | 48 8D 5B 10 | lea rbx,qword ptr ds:[rbx+10]
40C01D | E8 C1 F0 FF FF | call wf.40B0E3
40C022 | E8 BE F2 FF FF | call wf.40B2E5
40C027 | 48 FF 04 24 | inc qword ptr ss:[rsp]
40C02B | 48 FF 44 24 08 | inc qword ptr ss:[rsp+8]
40C030 | 0F 81 E7 FF FF FF | jno wf.40C01D
40C036 | 48 8D 64 24 10 | lea rsp,qword ptr ss:[rsp+10]
40C03B | C3 | ret

Now I'm gonna have to study the PE file format so I can get it to output an executable, and then it'll be self-hosted.
>>
>>57655497
is this assembly?
>>
Pycucks, can i use a list as a class variable?
>>
>>57655485
char *last_slash = strrchr(name, '/');

then from last_slash to the end is the filename.
Returns null if no slash found, so special case that and grab the whole string if you want "filename.png" to work.
>>
File: 1432259490310.jpg (68KB, 700x700px) Image search: [Google]
1432259490310.jpg
68KB, 700x700px
>>57655531
say im not a cuck first and ill tell u
>>
>>57654682
what is this senpai
>>
>>57655485
You might want to make a function like this
void filename_from_path(char *filename, size_t size, char *path){
for(int i = strlen(path);i >= 0;i--){
if(path[i] == '/'){
memcpy(filename, path+i, strlen(path+i));
}
}
}

Make sure to change the direction of the slash on other platforms and do some sanity checks on the writing to filename
>>
File: mc.png (99KB, 208x346px) Image search: [Google]
mc.png
99KB, 208x346px
>>57655497
>>
>>57654160
If you really are, stay on it buddy. Make sure you get as much math education as school will give you and more outside it, might be mundane at first but once you have a basic understanding it actually becomes really cool because you can program with it.

>ywn underage middle schooler shitposting on 4chan and writing vb again
>>
>>57655539
You are not a cuck
>>
>>57655232
Well I agree with the analogy but the point is rather why use a crappy knife instead of a good one?
>>
>>57655550
yeah, forget about this, listen to >>57655538
>>57655538
>>
>>57654904
>this subtle b8
>>
>>57655370
I don't get this meme. Ikea furniture assembly is stupid easy. The problem with their furniture is that it's not intended to last. It's easily replaceable goods.
>>
File: 2.jpg (45KB, 409x409px) Image search: [Google]
2.jpg
45KB, 409x409px
>>57655555
the answer: [spoiler] get cucked [/spoiler]
>>
>>57655522
It's a native code compiler for the language Forth written in assembly for Win64 (well bootstrapped in assembly, when it is self-hosting the compiler will be written in Forth itself)
>>
>>57655555
anyways, u can. Look at this example on stackoverflow

http://stackoverflow.com/questions/9751554/list-as-a-member-of-a-python-class-why-is-its-contents-being-shared-across-all
>>
File: 1476548237840.jpg (40KB, 431x420px) Image search: [Google]
1476548237840.jpg
40KB, 431x420px
>>57655619
Thanks [spoiler]cuck[/spoiler]
>>
>>57655169
if you hide prelude's . and id and import . and id from control.category (and import Kleisli) then you can use . (>=>) and id (return)
>>
>>57655497
>>57655613
I have to congratulate you. That's some next-level shit.
>>
File: 1438314435385.png (179KB, 405x406px) Image search: [Google]
1438314435385.png
179KB, 405x406px
>>57655643
btw i dont even know python that well. I have started the class section. Power of google my friend
>>
>>57655497

Why would you make your own version of assembly?
>>
>>57655674
literally what
>>
>>57655654
Forth is actually an extremely simple language. It's RPN/postfix notation, so no syntax to really care about.
All you need to implement it is a function for reading a line of text, parse it for space delimited words, lookup words in a dictionary, call the function associated with it if found, otherwise try and parse a number and push it on a data stack.
Keep track of two states, interpreting and compiling, the same text+parse main interpreter can be used for both, you just either do the 'compiling action' or the 'execution action' for the word you looked up.
>>
>>57655497
Looks like you are following the jonesforth tutorial?

https://github.com/AlexandreAbreu/jonesforth/blob/master/jonesforth.S
>>
I kept getting bad memory access. Took me like 20 minutes to figure it out. god damn it feels good though now. I was getting close to just saying fuck it, but I stuck to it.
>>
>>57655786
What language is this? Next time this happens, try out Valgrind
>>
>>57654160
Git gud at maths and physics
Think of a difficult-but-possible project and work towards it without giving up
>>
>>57654569
>Installed VS 2010
>Going fine
>1 month later I get asked to log in to continue use
>Create a MS account
>Try to log in
>Errors
>Google says errors solved by downloading IE 10
>Download IE 10
>Install
>"Please restart your computer"

Haven't opened it since. Microsoft are such cunts
>>
>>57652635
working on my box2d editor after a hiatus because my internet was utterly fucked for a few days. im almost done
krogank9.github.io

got bodies working in the web player, now i need to get exporting joints done
>>
>>57654160
Here's a classic problem:

Take a number N. If N is even, divide by 2. If N is odd, multiply by 3 and add 1. Keep repeating this process over and over again. For most numbers, you eventually end up at 1.

Your task is to find the first number where it DOESN'T end at 1. It might be challenging at first, but if you're clever, you can figure it out.
>>
>>57655674
This is just a rudimentary 'copying assembler' (I write the assembly I want to generate, use fasm to assembly the machine code, copy&paste that to memory where I need it and resolve forward branches with relative displacements) because I haven't finished any higher abstractions yet.
>>
>>57655792
Valgrind is fucking magical.
>>
what is the point of a class method? The only time I see class methods are for generic things like returning universal info/data/whatever, e.g. with a class Colors() I might have Colors.red() or something

is that the only use for class methods?
>>
>>57655665
Found my problem, i had to create the array before filling it that's why it wasn't working, makes sense but python unaccustomed me from initializing variables.
>>
File: ytp.png (39KB, 750x347px) Image search: [Google]
ytp.png
39KB, 750x347px
Working on a script to pull youtube video links and titles (and later more info) into a curses interface, then stream the videos through MPV so I hopefully never have to expose my browser to that aids ridden website again

I managed to get it to ignore chink characters for now until I figure out how to display those correctly, but I'm drawing a complete blank on the name of those URL-sanitized codes for punctuation.
The
#39;
In the second and fifth entry, for example.
It's obviously an apostrophe, but I can't recall the format it's in to look up how to convert it back into standard characters.
>>
Are there any programs I could create that might impress a qt girl?

>"Wow anon, this game is so amazing"
>"You're so smart, I bet you'll be a millionaire one day!"
>"D-did you want to stay the night?"
>>
>>57655876
>Are there any programs I could create that might impress a qt girl?
yeah, any program that makes you a shit load of money. women are soulless
>>
>>57655876
make an ios app, bitches love apps
>>
>>57655876
literally just be lower-mid middle class off of your single income and they'll call you smart when you say you're a software developer. Only other software developers that are women are going to give two shits what you actually make.
>>
>>57655921
Currently working on an Android app, I could port it to ios, but I don't think girls are interested in fluid simulation
>>
>>57654343
well this laptop was for the low low price of free

I mostly use it for IRC or terminal shit, just fun not serious stuff. I have a thinkpad and desktop but my thinkpad's battery is kinda fucked. This thing lasts for like two days without charging, even less without connecting to the internet. Don't really need a new machine.
>>
>>57655946
fluid simulation is like 30 seconds in spritekit my nigga
probably already exists
in fact I'm gonna google it before I submit this post
aw shit there are like 20 different github projects for this, here's one
https://github.com/kevinhartman/LiquidKit
>>
>>57654267
Run emacs in terminal mode.
The GUI application is an unoptimized hunk of shit.
>>
>>57655870
Try Not To Laugh or Grin While Watching AFV Funny Vines - Best Viners 2016
>>
>>57655946
>fluid simulation
what about fluid stimulation
>>
>>57655892
>>57655941
My current goal is to make £10 a day from app revenue. It means I don't have to get a job to continue to live. I won't be making much money anytime soon unless I get lucky

>>57655967
I didn't claim that I invented fluid simulation. I'm doing some fun and interesting things with it, it's unique and there's nothing like it
>>
>>57655777
I've definitely studied it, but jonesforth is an indirect threaded implementation with dictionary, code and data all in the same place and the inner interpreter just pops addresses and dispatches to them.
I make all words subroutines and call/ret to them, and my dictionary structure is [name][xt][xt] where xt is address of the execution semantics, ct the compilation semantics.

For example this is the inliner for DUP:
c_dup:
mov rdi, [code_here]
mov rdx, $038948F85B8D48 // the machine code for DUP
mov [rdi], rdx
add rdi, 7
mov [code_here], rdi
ret


so instead of call dup, it dumps the code for the dup inside the definition being compiled.
And later on I will add peephole optimization to this function to eliminate redundant dups, so if for example the next word is some arithmetic like:
: square dup * ;

Just fold that to a singly imul instruction.

It's actually a simpler implementation than jonesforth because I don't even have to check an F_IMMED flag or anything:
When compiling, call the 'ct', when interpreting call the 'xt' and that's it.
>>
>>57655996
>I didn't claim that I invented fluid simulation. I'm doing some fun and interesting things with it, it's unique and there's nothing like it
I wasn't criticizing you, I was just making a suggestion

>My current goal is to make £10 a day from app revenue. It means I don't have to get a job to continue to live. I won't be making much money anytime soon unless I get lucky

This is perfectly realistic if you put in an 8-hour work day every single day and don't give up senpai
>>
>>57655986
It just wget's the front page and strips everything apart with a regex pass. I'm planning on adding in a search function and long-term I'd like to use OAuth tokens through the youtube API so you can get your subscriptions/recommendations/playlists/etc.

It's basically in zygote stage right now. I'm spending most of the time fighting with curses.
>>
>>57655870
>I managed to get it to ignore chink characters for now until I figure out how to display those correctly, but I'm drawing a complete blank on the name of those URL-sanitized codes for punctuation.
>The
>#39;
>In the second and fifth entry, for example.
>It's obviously an apostrophe, but I can't recall the format it's in to look up how to convert it back into standard characters.

This?

http://www.w3schools.com/tags/ref_urlencode.asp
>>
File: 1479002147263.jpg (507KB, 1618x1566px) Image search: [Google]
1479002147263.jpg
507KB, 1618x1566px
>studying Mechanical Engineering
>mechanisms professor assigns us a proyect, a software to design cams from pre defined functions and make the corresponding plots
>be the only one who made a GUI for it and off matlab, which is easy as fuck
>'duuude you should have gone to CS, maann that program is so dope'

I hate my school
>>
>>57656037
That's what I originally thought, but that uses %, not #. Plus even if the symbol was interchangeable %39 is 9, not '
>>
>>57656010
Don't use curses use Termbox instead
>>
>>57656049
>falling for the STEM meme only to fall for the don't fall for CS meme
Dumb frogposter
>>
>>57656061
Not supported in Perl.
>>
some1 try my editor r8 & h8 plx

https://krogank9.github.io/box2d_editor/editor.html

i havent got joints done yet but its fun you can draw boxes then hit the play button. draw a static instead of dynamic box to make a floor
>>
File: drak.jpg (23KB, 610x335px) Image search: [Google]
drak.jpg
23KB, 610x335px
>>57656076
> Perl

breh
>>
>>57656099
drek is a stupid meme just like perl
>>
>>57656103
drek is white and based
>>
I'm taking a college level programming course. Half my classes focus on oop concepts, while the other half focus on "agile" development. Aren't these two things totally contradictory? From what I understand, oop pretty much only works if you are able to plan out the entire project ahead of time, meanwhile agile is suppose to be about flexibility. Am i being memed?
>>
>>57656099
>Use [my language that's just as stupid] instead!
Regex isn't part of ANSI C
Python is trash
The other languages supported are only done so through a wrapper and are meme languages anyways
>>
>>57656120
OOP is a style of programming and Agile is a style of development process.
The point of Agile is that there is a plan in place, the developers do features in a given cycle, the testers then throw back the bugs and problems they find, and this continues through various numbers of cycles until a stable release is ready with the required number of features added and tested.

As opposed to waterfall where you write in all the features first, then have to spend 3 months testing it, only to have to go back and rework a shitload of features anyways.

It's basically "Do a little, test a little. Do a little, test a little", it has nothing to do with the style of programming itself.
>>
>>57656123
https://hackage.haskell.org/package/ncurses
https://github.com/adinapoli/termbox-hs
>>
>>57656120
OOP is a product of the waterfall age, and it is a natural fit for the "on the first day god wrote the design document, and it was good" style of development, but that doesn't mean it doesn't work for agile development; you just need to be flexible and willing to go back and change existing code, which you'll be doing regardless of the paradigm you're working in.
>>
>>57656154
>Don't use [old language], use [old language] instead!
Nigga I just wanna know what the stupid encoding on that apostrophe is called.
>>
>>57656120
Yes they're contradictory. OOP people often argue their programs are malleable but they're really not. And when you try to modify them you more often than not break OOP principles or it's practically rewriting the software.

But trying to do agile development in a true OOP environment is impossible.

Ideally they'd teach you different approaches and have you choose. But if you're only introduced to agile development and OOP i suggest you look outside your curriculum if you care to be educated.

It's not like you can't get a job with what they teach you though. So if that's fine just accept it.
>>
>>57653035
>turn 360 degrees and walk out?
kek
>>
>>57653128
>rounding
>>
>>57652922Suit for the insurance company
>>
>>57656308
What?
>>
>>57656144
>>57656165
How can you possibly do a little, test a little when you have class hierarchies and everything is dependent on each other? I've only done small projects for school and already I'm finding I have to do a lot of back tracking when I hit a roadblock. It is a total pain in the butt.

>>57656210
Well I secretly want to be a game developer with working at a real company as a backup, so I want to get educated on the software development cycle for my own sake. It seems like most problems come from the developer's clients changing the goal posts or miscommunication though.
>>
>>57656096
It's nice.
Weld doesn't work though? Or am I just stupid. I'm overlappign two objects. Select them both, tap joint where they overlap. Doesn't seem to do anything.

Did them separate just in case I didn't understand what a joint is.
>>
>>57656120
agile = 'flexibility'
im flexible on my own, totally, @ 3am
im not flexible in an office with someone breathing down my neck
agile is horrible
>>
Semi-beginner in C++ here
What's a good way to validate user input for an integer without using for(;;) or while(true)?
>>
>>57656445
>I want to secretly be a game developer
>I want to get educated on software development cycle for my own sake
Well I have the perfect resource for you.
https://hero.handmade.network/episode/code/day026
This is the episode where he starts talking about his way of doing software architecture (continued in ep27) and the thinking is very enlightening and in my experience (and from watching him and other off-shoot projects) it's very effective.

The only flaw I see is the exact thing it seems you might be avoiding which is team coordination. When you work with others it's likely you need some bounds to what you're supposed to do simply because it makes interacting easier.
>>
>>57656497
No breaks, either
Sorry, forgot to include that.
>>
>>57655991
It's a secret ^^
Can't let anyone steal my ideas

>>57656004
>I wasn't criticizing you, I was just making a suggestion
Sorry, I'm in a defensive mood

>This is perfectly realistic if you put in an 8-hour work day every single day and don't give up senpai
Thanks anon, I'm trying my best!
>>
>>57656497
Try converting it to an integer and catch any exceptions. This doesn't work when only the last half isn't numbers.
>>
>>57655156
what functions do you need in such old version?
>>
>>57656497
>>57656516
Have an if statement and close the program if they fail to input.
I'm not sure I know what you're asking here. If you want them to input a new number again you need some form of iteration.
You can do a recursive call in a branch like
void handleinput(int i){
if(inputIsValid(i)){
//accept input
}
else{
handleinput(i);
}
}


But your request seems very arbitrary. Is this homework? If it is that's fine. Just get through it and forget it. Nobody will ask you to do this without loops.

Goto's are also an option.
>>
>>57656558
Not him but I'd bet it's windows compatibility.
>>
File: restrictions.png (24KB, 948x389px) Image search: [Google]
restrictions.png
24KB, 948x389px
>>57656578
Yeah, it's basically homework, we're working on making a program under these restrictions. Functions something like this.
>Use arrays for storing user input for hours worked and pay rate for 7 employees
>Display the data at the very end of the program
>>
Is there a major difference in performance when using html 5 canvas over webgl?
>>
>>57656623
>those restrictions
The first three are common sense
The fourth one I can understand being a benefit to discouraging students from misusing dangerous constructs
The fifth one is fucking retarded
>>
>>57656446
Interesting, it's working for me right now. I don't have to joints done in the physics player but it still should let you create one. You sure you have exactly 2 objects selected?
>>
>>57656623
>no infinite loops
Ah, so basically you're allowed to do what I'd assume you were thinking (read input, if OK break) but you have to use a flag instead.
int input=0;
bool inputIsValid=;
while(!inputIsValid){
scanf("%d",&input);
if()//validate input here
{
inputIsvalid=true; //now next time the condition is checked it will be false, breaking the loop
}
}


You can use that in any place where you would normally break an infinite loop and it will be just the same. There, you've completely avoided rule 4 for every case.
>>
File: debug.gif (803KB, 1261x779px) Image search: [Google]
debug.gif
803KB, 1261x779px
>>57656662
<--
This is what I'm doing
>>
>>57656683
>
bool inputIsValid=;

Should be
bool inputIsValid=false;

Hastily written.
>>
>>57656623
You are allowed to use loops, just not infinite loops. In c++ there is no way to find out the size of an array so you have to store it in an associated variable. You are basically suppose to figure out that you can loop through each character of your input and check to see if it is a number.

Heres an easy way of checking for a valid in. Don't use it though cause it is mine and you can't have it.
bool IsStringInteger(string sInput)
{
char character = o;
int number = 0;

stringstream linestream(sInput);
return ((linestream >> number) && (linstream >> character));
}
>>
>>57656648
If you code logically then you'd never need a break statement.
>>
>>57656739
>excluding a major use of switch cases arbitrarily
You do you you kook.
>>
>>57656120
No, you're just retarded.
>>
>>57656648
>>57656683
>>57656726
Thanks guys.
>>
>>57656760
The restriction specified loops, not switches
>>
>>57656779
You said that you never need a break statement though.
>>
>>57656793
No I didn't. >>57656739 said that.

Regardless, it was obvious from context what he actually meant.
>>
File: selfmod.png (187KB, 967x958px) Image search: [Google]
selfmod.png
187KB, 967x958px
Just gonna leave this here...
>>
>>57656500
that link is great
>>
>>57656869
What is this witchcraft?
>>
>>57656869

I don't get why you would do this. There are much clearer ways mix ASM and C code.

That being said, if it is just to test your understanding, good job, I guess.
>>
>>57656921
Not mixing asm though, the asm to the right is just the result, and the parts in the left are just to get adresses.
>>
Det er på höy tid at noen lager et nytt tråd.
>>
>>57656700
yeah i need to implement the joint feature in the player still :( after that its pretty much done
>>
>>57656933

You're using the keyword to designate labels for where the code will go, and while not straight assembly, it is still assembly regardless.

You could've probably done the same thing with goto and some more pointer arithemetic in C.
>>
>>57656901
Reading and writing binary to executable memory.
>>
NEW THREAD NOW!

>>57656992
>>57656992
>>
>>57656978
I couldn't, because I can't assume the size of each instruction, how would you go about doing so?
>>
>>57656997

The program is non-portable as is. It's not like putting the sizes is going to detrimentally affect how it runs. But yes, if you are talking about the way you went about it, then you can't translate your program 1:1 into ISO C.
>>
>>57657031
The mmap part is non-portable between OS's, not architectures, and there are equivalent functions for every major OS. If I wanted a portable solution, I would go with any asm jit library such as libjit. Obviously, this was just for the lulz.
>>
File: 1294912012.jpg (224KB, 817x1222px) Image search: [Google]
1294912012.jpg
224KB, 817x1222px
>happy thanksgiving
>>
>>57652635
I'm going to go through the little schemer, and I'm sort of new to programming, should I do SICP afterwards?
Thread posts: 326
Thread images: 29


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