• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Rur0ni

Member
Any Powershell gurus in here? Any recommended resources out there to put me on the fast track? I've been stubborn for the past few years and avoided it; now I must bite the bullet.
Don Jones' Month of Lunches series. Everything you'll need as a baseline is in there.

There's more specific books as well, but with that, and some time doing Scripting Games, you'll be ace.

If I had to add another, perhaps it would be PowerShell Best Practices. Written by Ed Wilson, the Scripting Guy.
 
Yes, you could have used i or whatever instead of _. But it's common practice in Python (and at least one other language) to use _ as a throwaway variable. In that way, a glance at the expression tells you that the assignment isn't important (and you won't have to worry about it rebinding another variable by mistake).

I see, thanks a lot for the help!
 
That's strange, because I think the exact opposite... I've had huge troubles because my laptop was on windows, even with Cygwin being a huge help, when my Linux machine was set up in minutes.
Problem 1 is here. Don't use cygwin. I know cmd is garbage, but if you're on windows you need to embrace the windows way, which means not using cygwin. You'll stumble for a bit, but eventually you'll learn how to do everything just as fast as you could on linux.

I'd be curious of the best way to have gcc, gdb and valgrind running in a couple of automatic install. Truly interested, actually...
Problem 2 here. Why do you need to use gcc and gdb when you've got a perfectly good toolchain with visual studio? It has all the memory diagnostic stuff built in, so you don't even need valgrind. And the debugger is at least an order of magnitude better than gdb. With vs2015 it's almost completely c++11 and c99 conformant. Gone are the days of horrible language support. Even has a builtin Python debugger that is also best in class.

I've even nightmares each time a fresh windows install forces me to go through the installation, configuration, and often rebuild of SDL, FLTK, Boost, Blitz, QT, etc. Especially because I want a mingw toolchain in Cygwin, but even without that...
Not a great solution here. However Most of these are fairly easy installs. Haven't used all of them, but if one them were difficult to install / build my first inclination would be to upstream some patches to make it easier. It would pay dividends in the long run, since everything else is so much easier.

For the UI libraries, i will say that unless you specifically need a cross platform UI, i find that 99% of the time i can do my UI in c# and the rest of the app in native code. Eliminates the need for qt and fltk. Doesn't work when you need portability obviously, but when you don't it can shave literally months off your time since it's so easy to design UIs in .net.

In any case, The #1 mistake people make when using windows is trying to use mingw.
 
Problem 1 is here. Don't use cygwin. I know cmd is garbage, but if you're on windows you need to embrace the windows way, which means not using cygwin. You'll stumble for a bit, but eventually you'll learn how to do everything just as fast as you could on linux.

Powershell. Seriously, Microsoft made a fantastic shell. You still have to learn the Microsoft way, but I find myself using it more and more. Makes switching back and forth between linux easier.
 
Powershell. Seriously, Microsoft made a fantastic shell. You still have to learn the Microsoft way, but I find myself using it more and more. Makes switching back and forth between linux easier.

I still haven't learned Powershell, but I need to. It's funny because everyone's first instinct when they see Powershell is "uhh, wtf is that shit?" It's universal, everyone says that. But everyone who managed to get over that hump, including hardcore Linux people without fail tell me that it's an amazing shell. I've tried a few times and never gotten over that hump.

It's weird that it has this stigma associated with it.
 
I didn't know Python had all of these functional features.

Python is actually a mixed language where you can either use functional programming or an Object Oriented programming approach.

If you want you can even mix and match as much as you want, although I think that is kind of frowned upon.
 
I still haven't learned Powershell, but I need to. It's funny because everyone's first instinct when they see Powershell is "uhh, wtf is that shit?" It's universal, everyone says that. But everyone who managed to get over that hump, including hardcore Linux people without fail tell me that it's an amazing shell. I've tried a few times and never gotten over that hump.

It's weird that it has this stigma associated with it.

As soon as I learned it was an object based shell as opposed to the character based shell of Unix I had to look into it. Having an interactive .NET toolkit at your disposal is so helpful I can't even describe it.

Really, I wish Unix shells would adopt some of the features from Powershell and vice versa but I know that'll never happen.
 

Tacitus_

Member
Code:
    string sana;

for (string::iterator it = sana.begin(); it != sana.end(); ++it)
	sana_set.emplace(*it);

Is *it being a char compiler dependent optimization or a feature of c++? I first assumed it would be a string which failed the emplace operation as I tried to enter it to a set<string>.
(this was a homework assignment to take a user entered string and spit out the letters used using set
 
Code:
    string sana;

for (string::iterator it = sana.begin(); it != sana.end(); ++it)
	sana_set.emplace(*it);

Is *it being a char compiler dependent optimization or a feature of c++? I first assumed it would be a string which failed the emplace operation as I tried to enter it to a set<string>.
(this was a homework assignment to take a user entered string and spit out the letters used using set

*it of any sequence is one element of the sequence. Hence by definition in a sequence of chars, the value type of an iterator to that sequence is a char
 

cocopuffs

Banned
First year comp-sci student at a uni and recently had a comp-sci test, not very confident about how I did on it. While on a PC, coding isn't particularly difficult as I can experiment and see what works and what doesn't, having to write out all your code on paper is an entirely different ball game.

How do I get to the point where writing code (Python 3 btw) on paper isn't so hard?
 
First year comp-sci student at a uni and recently had a comp-sci test, not very confident about how I did on it. While on a PC, coding isn't particularly difficult as I can experiment and see what works and what doesn't, having to write out all your code on paper is an entirely different ball game.

How do I get to the point where writing code (Python 3 btw) on paper isn't so hard?

Writing code on paper sucks. It's normal to be worse at it than normal coding. An important skill is to have a mental model of your code, to have some sort of idea of what happens with the different parts of your program as it progresses. Being able to "play though" the program in your head, sort of. If you're a visual person, it can help to do flowcharts or other visualizations of your code.
 

upandaway

Member
First year comp-sci student at a uni and recently had a comp-sci test, not very confident about how I did on it. While on a PC, coding isn't particularly difficult as I can experiment and see what works and what doesn't, having to write out all your code on paper is an entirely different ball game.

How do I get to the point where writing code (Python 3 btw) on paper isn't so hard?
It's just practice, you'll get used to it eventually. Especially with Python you'll get the hang of it very fast if you put yourself through the ordeal a couple of times (for my Intro to CS final we had to write merge-sort, without learning it before, in C)

I'd say the fastest way to get used to it is to try solving long, complex questions that were clearly meant to be solved on a PC. The trick is to write all the way up to the final solution, including all the tabs and semicolons, and not just stop at pseudocode.
 
What kind of job are you looking for? The place I work is hiring Android Engineers.

Saw this on Twitter:

Myths and Oversimplifications in Software Engineering.

Honestly, I started to feel that pressure to get expose to a bunch of technologies, but I prefer to know something very well than to just know a little bit just to put on a resume.

I gotta brush up on my notes because it's been a year since I worked with it, but I would be down to work with Android.

The class i took went over activities, list views, intents, basic UI, and a few other things. Would this basic knowledge be enough to be a developer?
 

Koren

Member
Problem 1 is here. Don't use cygwin. I know cmd is garbage, but if you're on windows you need to embrace the windows way, which means not using cygwin. You'll stumble for a bit, but eventually you'll learn how to do everything just as fast as you could on linux.
I really need portability... I agree that Visual is a way to solve many issues, but that doesn't work well with what I have to do.

About cygwin, I agree that Powershell is nice. Cygwin is a nice cmd replacement, though. I avoid compiling with it for licenses reasons, thus mingw, but it clashes a bit with Cygwin... Also, some tk sometimes have issues.

Problem 2 here. Why do you need to use gcc and gdb when you've got a perfectly good toolchain with visual studio?
It used to be the fact it wasn't free and low support of the language, but it's not true. Now, it's indeed not much valid.

Doesn't work when you need portability obviously, but when you don't it can shave literally months off your time since it's so easy to design UIs in .net.
I do need portability.

But at the same time, FLTK is portable and even easier than .Net, I think.
 

Somnid

Member
C++ is shit on windows. It's so hard to setup and it's not portable. VC++ has it's own project files and other stuff that make it unusable elsewhere. It's really unfortunate that such a widely used language in 30 years hasn't received a simple installer that lets you just run "compile main.cpp" in the command line. I hope and pray all the time that rust finally starts a new era of low-level coding.
 
C++ is shit on windows. It's so hard to setup and it's not portable. VC++ has it's own project files and other stuff that make it unusable elsewhere. It's really unfortunate that such a widely used language in 30 years hasn't received a simple installer that lets you just run "compile main.cpp" in the command line. I hope and pray all the time that rust finally starts a new era of low-level coding.
I love cargo.

Want to compile your program? Just run cargo. Don't have a library? Run cargo to get the crate from crates.io. Need to run your tests? Good thing cargo has that built in. Benchmarks? Just a feature flag away. Generate markdown or html documentation? Thanks, rustdoc. Module dependency management? Oh shit, built into cargo. Need good errors? The compiler already gives you great ones.

Once Rust gets incremental compilation (by the first half of next year?) it'll be the good life.
 

JesseZao

Member
I've wanted to learn c++ on my own time for more low level practice, but rust looks interesting. Are people using rust in the industry yet or is it just a fashionable enthusiast language for now?

Edit: I mean industry in the broadest sense.
 
C++ is shit on windows. It's so hard to setup and it's not portable. VC++ has it's own project files and other stuff that make it unusable elsewhere. It's really unfortunate that such a widely used language in 30 years hasn't received a simple installer that lets you just run "compile main.cpp" in the command line. I hope and pray all the time that rust finally starts a new era of low-level coding.

1) Open visual studio command prompt from start menu
2) cl main.cpp && main.exe

Setting it up requires about 5 clicks.

You can use CMake for build system portability.

You can achieve OS portability any number of ways. Using the stl, boost, or crt for starters. Writing your own portability layer if you need more flexibility. Other operating systems aren't portable either. FreeBSD isn't portable to linux, it's just easier.

For compiler portability, no other compilers are either. Same with porting between gcc and clang. Incidentally Clang-cl gives you a single toolchain that installs into visual studio and is the same on windows as on other platforms without all the baggage that comes with mingw

Let me know if you have any other concerns, happy to help.


Neither rust, d, or any other language is going to overtake c++ any time soon. It has 30 years of institutional backing with millions of users. You don't just brush that under the carpet. It doesn't matter if the language is better, it doesn't have tools, it doesn't have debuggers, it doesn't have the same depth of library support, it doesn't have a community of millions of users.
 

Somnid

Member
I've wanted to learn c++ on my own time for more low level practice, but rust looks interesting. Are people using rust in the industry yet or is it just a fashionable enthusiast language for now?

Edit: I mean industry in the broadest sense.

Mozilla is the only notable entity I've heard of that has immediate interest in shipping something with it. It just reached 1.0 a few months ago so it's probably not on the radar for a lot of people because it lacks presence and maturity. I think once a few ship some large applications with it to put it to the enterprise test, people will be flocking to it because it's very ergonomic compared to C++. That will probably be several years from now.

1) Open visual studio command prompt from start menu
2) cl main.cpp && main.exe

Setting it up requires about 5 clicks.

You can use CMake for build system portability.

You can achieve OS portability any number of ways. Using the stl, boost, or crt for starters. Writing your own portability layer if you need more flexibility. Other operating systems aren't portable either. FreeBSD isn't portable to linux, it's just easier.

For compiler portability, no other compilers are either. Same with porting between gcc and clang. Incidentally Clang-cl gives you a single toolchain that installs into visual studio and is the same on windows as on other platforms without all the baggage that comes with mingw

Let me know if you have any other concerns, happy to help.

Thanks for the response, I'd love to see how other people do it (I'm more novice level) and I know it's possible but it's a pain. C++ is not especially opinionated and the number of times I've had to write apps with it have been a different mismash of build tools and libraries and none of them play nice with other platforms. It's also kinda crappy that you need something as bloated as VC++ to just get things to compile (and I'm by trade a .NET developer). Also up until about a year ago it was really expensive. Unix-based systems simply don't have this problem and I'm just generally baffled how it's persisted on Windows for so long and why anyone would even want to develop for it using Windows. I don't want new shells, I just want a simple windows CLI.

After using Java, Python, Ruby, Rust, Go, and Node, C++ is still orders of magnitude harder to get working on windows.
 

barnone

Member
hey software engineering gaf. I am looking to expand my skill set, and was looking for opinions on what y'all think is valuable. i've done mostly android/ios/.net, with some ruby on rails. also majored in comp sci, so I think I have a good foundation to start delving into anything. I mainly want to future proof my skill set.
 
I've wanted to learn c++ on my own time for more low level practice, but rust looks interesting. Are people using rust in the industry yet or is it just a fashionable enthusiast language for now?

Edit: I mean industry in the broadest sense.
Mozilla is the only notable entity I've heard of that has immediate interest in shipping something with it. It just reached 1.0 a few months ago so it's probably not on the radar for a lot of people because it lacks presence and maturity.
There are some early adopters in industry that are using it to good effect and 8 in particular have been working closely with Mozilla to provide valuable feedback. This was back in July. I don't know if the early adopters group has expanded. As for "fashionable", it's very fashionable right now. Strong functional language with closures, lambdas, no inheritance, algebraic data types, nested modules, haskell style typeclasses with associated types, bounded regions, pattern matching, slice syntax, lazy iterators, complete memory safety, local type inference, safe scheme style metaprogramming (works on typed lexical structures, not text), complete thread safety enforced by the compiler, message passing concurrency via channels like go, RAII, iterator based for loops, and pretty soon we're going to be able to pass around stack allocated closures and have a basic form of refinement types. Seems like all the stuff that's in fashion right now.
Neither rust, d, or any other language is going to overtake c++ any time soon. It has 30 years of institutional backing with millions of users. You don't just brush that under the carpet. It doesn't matter if the language is better, it doesn't have tools, it doesn't have debuggers, it doesn't have the same depth of library support, it doesn't have a community of millions of users.
D and "any other language" are not garbage collector free with compiler enforced memory safety and c++ performance. That's what separates Rust from D, from Go, from Java, from C#, and every other language that has ever tried to be the next systems programming language.

It is hard to unseat hulking inertial masses. But if the success of Swift over objective c has taught us anything, then replacing languages which are old and flawed compared to modern standards is met with hasty adoption if the replacement satisfies requirements. It's why Java replaced C++ and C in application development where real-time constraints were not important. So since Rust fixes everything conceivably wrong with c++ and still offers real time guarantees, I predict that half, if not more, of all non-embedded c++ jobs will be converted to Rust in 15 years. Why would Herb Sutter want to sit down and talk with the Rust core team about similarities and differences between the two languages if he didn't see something of value in there?
http://www.reddit.com/r/cpp/comments/3m0d41/writing_good_c14_by_default_herb_sutter/cvhal60

You're right, it's hard to get rid of libraries and tooling. ...So it's a good thing Rust is ABI compatible with C and C++, and C/C++ can call Rust code and vice versa. And furthermore, maybe some things exist just because the language is at fault. Look at valgrind's features page:
http://valgrind.org/info/tools.html

Out of the six main toolsuites, half of them (memcheck, Helgrind, and DRD) are completely unneeded in Rust because of the design of the language.

Object slicing is not possible. Use after free is not possible. Memory access errors like data races and moving references to TLS across thread boundaries is not possible.

The industries that don't adopt this in the next 10 years are just asking to lose money.
 

Koren

Member
I love cargo.
I really must look into it...

Other operating systems aren't portable either. FreeBSD isn't portable to linux, it's just easier.
Far, far easier, though. And I've had far less trouble between Linux and MacOS than with Windows. Actually, cross-compilation for Windows in Linux is sometimes easier to setup.


Same with porting between gcc and clang.
Besides obvious uses of pragmas, I've had little trouble switching between gcc and clang (did this a lot for C++ X11 support recently).

Granted, I think switching to VC++ is probably easier now that they're far closer to the norm. Still, specific project files gives me headaches.

Neither rust, d, or any other language is going to overtake c++ any time soon.
I was hoping D would ten years ago, but I'm far more realist now.

I'm just sad that Java is seeing so much use nowadays because it's one of the very few languages I really don't like coding for :/
 
I really must look into it...


Far, far easier, though. And I've had far less trouble between Linux and MacOS than with Windows. Actually, cross-compilation for Windows in Linux is sometimes easier to setup.



Besides obvious uses of pragmas, I've had little trouble switching between gcc and clang (did this a lot for C++ X11 support recently).

Out of curiosity, have you tried clang-cl?

Granted, I think switching to VC++ is probably easier now that they're far closer to the norm. Still, specific project files gives me headaches.
agree, proprietary build systems suck. Luckily msbuild went open source, so expect to see things get easier over time.

There's also more good stuff on the (not immediate) horizon regarding visual studio and build systems, so keep your eyes out

Thanks for the response, I'd love to see how other people do it (I'm more novice level) and I know it's possible but it's a pain. C++ is not especially opinionated and the number of times I've had to write apps with it have been a different mismash of build tools and libraries and none of them play nice with other platforms. It's also kinda crappy that you need something as bloated as VC++ to just get things to compile (and I'm by trade a .NET developer). Also up until about a year ago it was really expensive. Unix-based systems simply don't have this problem and I'm just generally baffled how it's persisted on Windows for so long and why anyone would even want to develop for it using Windows. I don't want new shells, I just want a simple windows CLI.

After using Java, Python, Ruby, Rust, Go, and Node, C++ is still orders of magnitude harder to get working on windows.
Regarding a command line toolchain, I've heard there's going to be a command line only toolchain on the horizon. I'm honestly not sure why you'd want one except on a build server (you're missing out on arguably the best thing about it - the debugging tools) but whatever floats your boat.

I'm stil not sure why you say it's orders of magnitude harder on windows. Download visual studio, install, run, create project, type code, compile, run. Which step is causing trouble? After you finish the install, it takes 30 seconds to get a hello world running. 0 configuration necessary
 

Koren

Member
Out of curiosity, have you tried clang-cl?
No... But since I'm switching between Linux and Windows sometimes several times on the same week for a single project, I'm not very keen in using VC when my code editor (which is the same on both OS) run cmake smoothly.

I'll try it next time I've to work with VC, though.

agree, proprietary build systems suck. Luckily msbuild went open source, so expect to see things get easier over time.
Yes... Sometimes, I'd like seeing Microsoft using already established free solutions instead of creating its own, though.

I'm honestly not sure why you'd want one except on a build server
It makes things easier to work with the other tools you like. Such a different IDE... But yes, you make debugging a bit harder.

I'm stil not sure why you say it's orders of magnitude harder on windows. Download visual studio, install, run, create project, type code, compile, run. Which step is causing trouble?
Being able to compile and run existing code if there isn't a VC version, I'd say.

(and I still prefer typing "aptitude install libsdl2-dev" to add a library to any solutions I've encountered on Windows)
 
AXv1Nmf.jpg

BOY do i feel great.. i got this program to run the way it should and it was so rewarding when i compiled and saw that it works

i think im getting the hang of this :D
 

Rur0ni

Member
1) Open visual studio command prompt from start menu
2) cl main.cpp && main.exe

Setting it up requires about 5 clicks.

You can use CMake for build system portability.

You can achieve OS portability any number of ways. Using the stl, boost, or crt for starters. Writing your own portability layer if you need more flexibility. Other operating systems aren't portable either. FreeBSD isn't portable to linux, it's just easier.

For compiler portability, no other compilers are either. Same with porting between gcc and clang. Incidentally Clang-cl gives you a single toolchain that installs into visual studio and is the same on windows as on other platforms without all the baggage that comes with mingw

Let me know if you have any other concerns, happy to help.


Neither rust, d, or any other language is going to overtake c++ any time soon. It has 30 years of institutional backing with millions of users. You don't just brush that under the carpet. It doesn't matter if the language is better, it doesn't have tools, it doesn't have debuggers, it doesn't have the same depth of library support, it doesn't have a community of millions of users.
Well said. Respect.

I've gotten a pretty decent hang of C++ recently, and rather like the language. Just Windows development however. Visual Studio is ridiculously good as well.
 
No... But since I'm switching between Linux and Windows sometimes several times on the same week for a single project, I'm not very keen in using VC when my code editor (which is the same on both OS) run cmake smoothly.

I'll try it next time I've to work with VC, though.
You don't actually have to use Visual Studio. You can either run clang-cl on the command line, in which case you use it with MSVC command line arguments, or you can run clang.exe from the command line, in which case the command line is mostly identical to your clang command line on every other platform. In both cases you're getting actual clang, not msvc, compiling your code. You still need visual studio installed because clang-cl uses a few tools, but I don't expect that to be true in the future.

If you actually install LLVM, then it integrates into Visual Studio such that if you have an MSVC project ready to go, you can just set the toolchain to LLVM and it's all automatic.

No matter what you do, the great thing is that it produces binaries that are ABI compatible with MSVC. You can compile object files with clang-cl, and link them with MSVC's linker. You can create a static library with MSVC, and link against it with clang-cl. Wrap your head around that for a minute.

Yes... Sometimes, I'd like seeing Microsoft using already established free solutions instead of creating its own, though.
At the time it was the right decision. .NET didn't exist on other platforms, and having a build system that can deal with all the things .NET has to deal with, like assemblies, managed code, resources, and everything else necessitated having something that was built for that. We could argue that they should have open sourced .NET from the beginning, but we're talking about a different company 10 years than the Microsoft of today. MSBuild is honestly pretty good. Xml is xml, and in hindsight nobody likes xml, but the core ideas from MSBuild are pretty good and it allows a lot of reusability and customizability in your build process if you know what you're doing.

Being able to compile and run existing code if there isn't a VC version, I'd say.

I'd argue that's a fault of the project you're trying to compile for not using a reasonable build system. Make, for example, is utter crap. CMake, although it's not perfect, is superior in every possible way for the same reason that C and C++ are superior to assembly language. Some projects even have their own homegrown build systems. Also crap. people should know by now not to reinvent the wheel. I mean sure, at the end of the day you need to get stuff done, so you're going to use what works, but at the same time, the only reason it works on those platforms is because someone made it work. I guess it's because I work mostly on open source software, but as the old saying goes, "patches welcome".

(and I still prefer typing "aptitude install libsdl2-dev" to add a library to any solutions I've encountered on Windows)
Can't really argue with this one.
 

Koren

Member
I'd argue that's a fault of the project you're trying to compile for not using a reasonable build system. Make, for example, is utter crap. CMake, although it's not perfect, is superior in every possible way for the same reason that C and C++ are superior to assembly language.
CMake now works well with VC?

I agree on make as a build system, but it's a really old system, you can't expect it to be perfect to boot. Like Mercurial is leagues better than CVS. That being said, for not-too-complex (and sometimes quick'n dirty) code I don't need to share with other people, I sometimes use make, it's faster to type the ten lines you need than setting up CMake (works like a script that automatically check time in a sense).

I'll switch the build system the day the project gets bigger, or when I have to share it.


Or for all my LaTeX needs (I wouldn't even know what else to use beside a makefile?)
 
CMake now works well with VC?

Works pretty well, yes.

cmake -g "Visual Studio 2015" <path to CMakeLists.txt>

I only started using CMake about a year ago, and we used CMake 2.7 and VS 2010 (we're now up to CMake 3.x and VS 2015), and it's always worked pretty well from every combination of CMake >= 2.7 and VS >= 2010. It's possible there's some combination of versions earlier than that that didn't work well though.

The big problem I have with CMake and VC is that I work on a very large project. Egregiously large. And even without CMake, IDEs become pretty sluggish when working on big projects. So what I do now is use CMake to generate both VC projects as well as Ninja projects. If you haven't used Ninja yet it's ridiculously fast, you should try it, but it's designed to be generated -- i.e you don't write ninja by hand. Anyway I generate both into separate folders. Source browse, edit, and debug in VC by configuring the debug settings to point to the ninja-built executables, and always build on the command line by invoking ninja directly.
 

Slavik81

Member
Or for all my LaTeX needs (I wouldn't even know what else to use beside a makefile?)
CMake works quite nicely.
Works pretty well, yes.

cmake -g "Visual Studio 2015" <path to CMakeLists.txt>

I only started using CMake about a year ago, and we used CMake 2.7 and VS 2010 (we're now up to CMake 3.x and VS 2015), and it's always worked pretty well from every combination of CMake >= 2.7 and VS >= 2010. It's possible there's some combination of versions earlier than that that didn't work well though.

The big problem I have with CMake and VC is that I work on a very large project. Egregiously large. And even without CMake, IDEs become pretty sluggish when working on big projects. So what I do now is use CMake to generate both VC projects as well as Ninja projects. If you haven't used Ninja yet it's ridiculously fast, you should try it, but it's designed to be generated -- i.e you don't write ninja by hand. Anyway I generate both into separate folders. Source browse, edit, and debug in VC by configuring the debug settings to point to the ninja-built executables, and always build on the command line by invoking ninja directly.
CMake + Ninja also works beautifully under Linux.
 
I totes forgot we had a Programming OT and made a thread entirely on my problem, oops. Anyways I'll link the original thread I made but I'll just put it simply that I need help in C++ trying to do the below problem/program regarding Pipe Programming (this is for my OS class).

-----------------

Design a program using ordinary pipes in which one process sends a string message to a second process, and the second process reverses the case of each character and modify each character to the next one in the message and sends it back to the first process. For example, if the first process sends the message “Abcd”, the second process will return “bCDE”. Characters ‘z’ and ‘Z’ won’t be changed. This will require using two pipes, one for sending the original message from the first to the second process, and the other for sending the modified message from the second back to the first process. Write this program using LINIX pipes.

Examples:
“Am Dx”: the second process will return “bN eY”.
“wxYZ”: the second process will return “XYzz”. (Characters ‘z’ and ‘Z’ won’t be changed)
“Hello World”: the second process will return “iFMMP xPSME”.
 
I totes forgot we had a Programming OT and made a thread entirely on my problem, oops. Anyways I'll link the original thread I made but I'll just put it simply that I need help in C++ trying to do the below problem/program regarding Pipe Programming (this is for my OS class).

-----------------

Design a program using ordinary pipes in which one process sends a string message to a second process, and the second process reverses the case of each character and modify each character to the next one in the message and sends it back to the first process. For example, if the first process sends the message “Abcd”, the second process will return “bCDE”. Characters ‘z’ and ‘Z’ won’t be changed. This will require using two pipes, one for sending the original message from the first to the second process, and the other for sending the modified message from the second back to the first process. Write this program using LINIX pipes.

Examples:
“Am Dx”: the second process will return “bN eY”.
“wxYZ”: the second process will return “XYzz”. (Characters ‘z’ and ‘Z’ won’t be changed)
“Hello World”: the second process will return “iFMMP xPSME”.
*UNIX. Is this a question about pipes or programming?

For the latter: think of your program as a series of transformations. Text -> VerifyAllLetters -> ShiftRight -> ReverseCase
A good hint is that ascii characters can be treated as numbers.
For the former, here is a tutorial on pipe programming in C. http://www.tldp.org/LDP/lpg/node11.html
 
Anybody here know pumping lemma? I've watched a video on it and I still couldn't grasp the idea of how we use pumping lemma to indicate whether a language is regular or not. I know if a language is finite then it's regular, but if it's infinite then it's not regular.
 

Slavik81

Member
(and I still prefer typing "aptitude install libsdl2-dev" to add a library to any solutions I've encountered on Windows)
Chocolatey is one hell of a kludge in that it just uses PowerShell to download and run standard windows installers with their silent-install switch as an argument&#8212;but it works! Though, it probably works better for programs than libraries. SDL doesn't seem to be in there.
 

SOLDIER

Member
Latest assignment for Python 3, involves arrays of one dimension:

Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Design the following module to show the rainfall statistics:

//The showStats module shows high, low, average rainfall
Module showStats(Real high, Real low, Real total, Real average)

Program Output (with Input Shown in Bold)

Enter rainfall for January: 5
Enter rainfall for February: 3
Enter rainfall for March: 4
Enter rainfall for April: 4
Enter rainfall for May: 10
Enter rainfall for June: 12
Enter rainfall for July: 20
Enter rainfall for August: 25
Enter rainfall for September: 17
Enter rainfall for October: 11
Enter rainfall for November: 9
Enter rainfall for December: 8

High rainfall is: 25
Low rainfall is: 3
Total rainfall is: 128
Average rainfall is: 10.6667

Help, as usual, would be greatly appreciated.
 

Koren

Member

CMake works quite nicely.
Thanks, will look into it (although I'm not sure I really need anything fancier than a makefile... even my thesis compile on a makefile with two dozen lines...)

Chocolatey is one hell of a kludge in that it just uses PowerShell to download and run standard windows installers with their silent-install switch as an argument—but it works! Though, it probably works better for programs than libraries. SDL doesn't seem to be in there.
Interesting...

The issues with libraries, though, is that most of the time they need to be compiled, because the binaries aren't compatible with the rest of the toolchain. Should there be a working installer, it would be great. Unfortunately, the hard part is often to guess the parameters of the .configure that'll make the compilation succeed :/

Help, as usual, would be greatly appreciated.
There's barely any programming beside the input / convert-to-int / append-to-list part. For which part do you need help?

Look into functions like max(L), min(L), sum(L) and len(L) where L is a list (or any iterable, in fact, except for len which need a sequence)
 

Water

Member
Is there a website where I can learn how to code for visual studio in C#?
Code what in C#? Windows desktop apps on a particular type of UI? Windows mobile apps? Some kind of web stuff? Unity games? Visual Studio is just a development environment you can use while developing for any of these platforms and frameworks. C# beginner materials are scarce, and most of it is targeted towards one of these specifically. People tend to only learn C# for a specific purpose after they already have programming experience in something else, it is not popular at all as a teaching language. I'm one of the rare people who teach introductory programming with it, but that's because I have to get the students into Unity game development ASAP, can't afford to use a separate teaching language first.
 

upandaway

Member
Code what in C#? Windows desktop apps on a particular type of UI? Windows mobile apps? Some kind of web stuff? Unity games? Visual Studio is just a development environment you can use while developing for any of these platforms and frameworks. C# beginner materials are scarce, and most of it is targeted towards one of these specifically. People tend to only learn C# for a specific purpose after they already have programming experience in something else, it is not popular at all as a teaching language. I'm one of the rare people who teach introductory programming with it, but that's because I have to get the students into Unity game development ASAP, can't afford to use a separate teaching language first.
That's interesting, at least half of all the high schools around here use C# for high school CS, the other half uses Java (my HS had java). I'm enjoying it with Unity so far, it's a nice language.
 

JesseZao

Member
Latest assignment for Python 3, involves arrays of one dimension:



Help, as usual, would be greatly appreciated.

That's so basic. You need to figure it out on your own if you're serious about getting into programming. Go over your notes or the book. You probably just went over the needed concepts in class.
 
Top Bottom