Personal computing discussed

Moderators: SecretSquirrel, just brew it!

  • 1
  • 3
  • 4
  • 5
  • 6
  • 7
  • 10
 
morphine
Gold subscriber
Gerbilus Supremus
Posts: 11406
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Re: GCC errors with compiling C code.

Thu Nov 09, 2017 4:56 pm

Redocbew wrote:
Here's a real world example. At my last job I had a bug to deal with which seemed to be causing confusion between payment processors [...]

Web development is particularly tricky (I do it for a living). It's a particular brand of coding where anything can happen at any time, you are not in control of the client, any part of your program can be run at any point, multi-threading is implied, etc.

I so prefer writing little Python utilities where I know that if I showed a user a window, that's what he'll be looking at and he can't go behind my back and visit another [ URL / piece of code ] :P
There is a fixed amount of intelligence on the planet, and the population keeps growing :(
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Thu Nov 09, 2017 5:18 pm

morphine wrote:
Redocbew wrote:
Here's a real world example. At my last job I had a bug to deal with which seemed to be causing confusion between payment processors [...]

Web development is particularly tricky (I do it for a living). It's a particular brand of coding where anything can happen at any time, you are not in control of the client, any part of your program can be run at any point, multi-threading is implied, etc.

I so prefer writing little Python utilities where I know that if I showed a user a window, that's what he'll be looking at and he can't go behind my back and visit another [ URL / piece of code ] :P

Good grief, Web development sure does sound much harder then writing stand alone applications. :o
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Thu Nov 09, 2017 5:52 pm

Now I'm thinking I should cross compile for both Linux and Windows, and use Wine to test the programs? Granted it is more work but it is worth it if other people find my code useful and I can never know if "forced" to use Windows or not later on.
 
Redocbew
Gold subscriber
Graphmaster Gerbil
Posts: 1350
Joined: Sat Mar 15, 2014 11:44 am

Re: GCC errors with compiling C code.

Thu Nov 09, 2017 5:55 pm

Dude, take it slow. You'll be up to your eyeballs in compiler gak before you can blink. It's a marathon, not a sprint.

For reference, I'm not sure if you really can "cross-compile" for a different OS. Usually cross-compiling is done to generate code for a different hardware architecture.
Do not meddle in the affairs of archers, for they are subtle and you won't hear them coming.
 
morphine
Gold subscriber
Gerbilus Supremus
Posts: 11406
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Re: GCC errors with compiling C code.

Thu Nov 09, 2017 5:57 pm

If you do a simple command-line program, chances are you'll be able to run it across multiple OSes with few changes, so you don't need to involve an emulator. More to the point, first you need to learn to code, only much later you'll consider deployment, installation scripts, etc.

Should the time come when you want to write something with a user interface that runs across multiple OSs, there are a variety of GUI kits for that, namely but not only Qt, which I'm a fan of. Although I should note, if you're doing GUI stuff it's really best to stick to something that's inherently 99.9% OS-agnostic like Python. It's what I do, fwiw.
There is a fixed amount of intelligence on the planet, and the population keeps growing :(
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Thu Nov 09, 2017 6:05 pm

Thanks guys I'll focus on learning C for now and worry about the other stuff much later.
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Thu Nov 09, 2017 6:36 pm

Yeah, just worry about getting fluent in the basics of the language first, before you start worrying about cross-platform compatibility.
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 9:15 am

just brew it! wrote:
Yeah, just worry about getting fluent in the basics of the language first, before you start worrying about cross-platform compatibility.

Yeah you are right JBI. It will a long while before I have to worry about that. I have Gedit, Okular, and Bash opened on another workspace and Firefox opened on my main one. I'm starting to see why professionals are beginning to buy large 4K displays in droves.

Found this last night I might use it after I finish with my current manual:
https://linuxconfig.org/c-programming-tutorial
 
Vhalidictes
Gold subscriber
Gerbil Jedi
Posts: 1682
Joined: Fri Jan 07, 2005 2:32 pm
Location: Paragon City, RI

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 11:31 am

whm1974 wrote:
Good grief, Web development sure does sound much harder then writing stand alone applications. :o


The fun part is when you're all finished and then realize that whichever popular browser you didn't test can't display the app properly.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 11:45 am

Vhalidictes wrote:
whm1974 wrote:
Good grief, Web development sure does sound much harder then writing stand alone applications. :o


The fun part is when you're all finished and then realize that whichever popular browser you didn't test can't display the app properly.

Yeah I remember the Browser Wars of the 90's and early 2000's. It wasn't unusual at all for people to use three or four different Webbrowsers just read Webpages correctly. :roll:

Let's see, I've used Web Explorer on OS/2, IE, Netscape, and Opera on Windows, Netpositive and Opera with BeOS, during the 90's and 2001/2002.
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 12:12 pm

whm1974 wrote:
I have Gedit, Okular, and Bash opened on another workspace and Firefox opened on my main one. I'm starting to see why professionals are beginning to buy large 4K displays in droves.

After I started using one at work, I found I really missed the extra screen real estate when working from home. My ghetto solution was to dig a pair of old 17" LCDs out of the crawlspace and set up triple-head. Needed a HDMI to VGA adapter for one of them (like I said, these LCDs are old!), but since I already had the displays the $10 adapter was the only cost to more than double my usable display area.

Since you're budget-constrained, why not pick up a used LCD display at a garage sale or Goodwill, and set up dual-head? Do your development on the main display, and use the secondary one to view documentation and tutorials. This is at least an order of magnitude cheaper than getting a 4K display.

Maybe you even know someone who has an old 17" LCD you could have for free. You sure wouldn't want to use it as a primary display, but it's fine for viewing documentation.
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 1:11 pm

just brew it! wrote:
whm1974 wrote:
I have Gedit, Okular, and Bash opened on another workspace and Firefox opened on my main one. I'm starting to see why professionals are beginning to buy large 4K displays in droves.

After I started using one at work, I found I really missed the extra screen real estate when working from home. My ghetto solution was to dig a pair of old 17" LCDs out of the crawlspace and set up triple-head. Needed a HDMI to VGA adapter for one of them (like I said, these LCDs are old!), but since I already had the displays the $10 adapter was the only cost to more than double my usable display area.

Since you're budget-constrained, why not pick up a used LCD display at a garage sale or Goodwill, and set up dual-head? Do your development on the main display, and use the secondary one to view documentation and tutorials. This is at least an order of magnitude cheaper than getting a 4K display.

Maybe you even know someone who has an old 17" LCD you could have for free. You sure wouldn't want to use it as a primary display, but it's fine for viewing documentation.

Maybe I'll go over to Goodwill and see if they have some something suitable for my what I'm doing. This is [i]really ironic[/] because I have been using 19" two displays long before I built my current rig, and I gave the one that was still working after buiding this computer to a friend, as I was thinking "Who needs two displays when you have a 30" 2560x1600 one".

Oh the irony as I was considering keeping for learning C programming to display documentation at the time, but I never really started.
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 8:27 pm

Alternatively, just use your laptop to display the documentation. Can't copy-paste the examples if you do that though.
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 8:29 pm

just brew it! wrote:
Alternatively, just use your laptop to display the documentation. Can't copy-paste the examples if you do that though.

Great ideal, why didn't think of that?
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 8:31 pm

whm1974 wrote:
just brew it! wrote:
Alternatively, just use your laptop to display the documentation. Can't copy-paste the examples if you do that though.

Great ideal, why didn't think of that?

I've probably been doing this longer than you've been alive. :wink:
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 8:32 pm

just brew it! wrote:
whm1974 wrote:
just brew it! wrote:
Alternatively, just use your laptop to display the documentation. Can't copy-paste the examples if you do that though.

Great ideal, why didn't think of that?

I've probably been doing this longer than you've been alive. :wink:

I'm 43 how old are you?
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 9:07 pm

I set set up my terminal to green text and 80x48, seem to a bit more readable now and the green is more pleasing to the eye.
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Fri Nov 10, 2017 10:41 pm

whm1974 wrote:
just brew it! wrote:
whm1974 wrote:
Great ideal, why didn't think of that?

I've probably been doing this longer than you've been alive. :wink:

I'm 43 how old are you?

Ahh, OK... you're a few years older than I thought. The statement is in fact still true if I include dabbling in electronics and (later) computers non-professionally (which I've been doing since around 6th grade). :wink:
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 11:05 am

For some reason I'm going too fast to remember what I'm reading and finding myself having to go back and read the material over again. :evil: Is this normal and happens to everyone that is trying learn C or other programming languages?
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 12:25 pm

whm1974 wrote:
For some reason I'm going too fast to remember what I'm reading and finding myself having to go back and read the material over again. :evil: Is this normal and happens to everyone that is trying learn C or other programming languages?

Yeah, it's pretty normal. Until you've actually used the knowledge several times you won't internalize it.

It might help to make yourself a "cheat sheet" of notes for the stuff you're having trouble remembering. Just the act of typing it out will help you remember it; once you've made the cheat sheet you may find you don't need it any more!

TBH, these days it is not unusual for even professional developers to spend a large percentage of their time reviewing man pages for details of various system calls and library functions, and/or on Google and/or Stack Overflow. So once you've internalized the C language constructs, you'll still be spending a fair amount of time looking things up.

Real-world example: I'm still struggling with all the various sub-commands and options for git. This job is the first time I've used it professionally (was a Subversion user for years prior), and for anything outside the basic workflow I need to look stuff up. I feel like this guy: https://xkcd.com/1597/

As a software developer you are either constantly learning, or you are slowly becoming obsolete. Even if you're coding in an "old" language like C.
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 12:42 pm

just brew it! wrote:
whm1974 wrote:
For some reason I'm going too fast to remember what I'm reading and finding myself having to go back and read the material over again. :evil: Is this normal and happens to everyone that is trying learn C or other programming languages?

Yeah, it's pretty normal. Until you've actually used the knowledge several times you won't internalize it.

It might help to make yourself a "cheat sheet" of notes for the stuff you're having trouble remembering. Just the act of typing it out will help you remember it; once you've made the cheat sheet you may find you don't need it any more!

TBH, these days it is not unusual for even professional developers to spend a large percentage of their time reviewing man pages for details of various system calls and library functions, and/or on Google and/or Stack Overflow. So once you've internalized the C language constructs, you'll still be spending a fair amount of time looking things up.

Real-world example: I'm still struggling with all the various sub-commands and options for git. This job is the first time I've used it professionally (was a Subversion user for years prior), and for anything outside the basic workflow I need to look stuff up. I feel like this guy: https://xkcd.com/1597/

As a software developer you are either constantly learning, or you are slowly becoming obsolete. Even if you're coding in an "old" language like C.

Nice to know I'm not the only with this problem, and I should read xkcd.com more often.

On another note it seems that some people think that C/C++ are dying programming languages and everybody should simply quite using them and switched to newer and more modern languages. :roll: I remember all of the hype Java had back in late 90's about how it is going to replace all other languages because developers can "Write once, Run Everywhere".
 
Redocbew
Gold subscriber
Graphmaster Gerbil
Posts: 1350
Joined: Sat Mar 15, 2014 11:44 am

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 12:52 pm

I don't think C or C++ are going anywhere any time soon. The reason C is often used for low level applications is because it doesn't have the overhead of a more "modern" language like Java. The more a language does for you, the less control you have over exactly what the application really is doing at any one point in time. You've got to pay for those features somewhere.

Also, the idea that everything is eventually going to be rewritten in some other more recent language is a misconception. Old languages never really die. They just fade from popularity.
Do not meddle in the affairs of archers, for they are subtle and you won't hear them coming.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:00 pm

Redocbew wrote:
I don't think C or C++ are going anywhere any time soon. The reason C is often used for low level applications is because it doesn't have the overhead of a more "modern" language like Java. The more a language does for you, the less control you have over exactly what the application really is doing at any one point in time. You've got to pay for those features somewhere.

Also, the idea that everything is eventually going to be rewritten in some other more recent language is a misconception. Old languages never really die. They just fade from popularity.

Yeah it is very time consuming and expensive to completely rewrite large and complex programs in "Newer" languages especially if said languages haven't been around long enough to have a large number of developers who well tested and mastered them.
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:02 pm

whm1974 wrote:
...I should read xkcd.com more often.

Yes, you should.

https://xkcd.com/208/
https://xkcd.com/224/
https://xkcd.com/297/
https://xkcd.com/303/
https://xkcd.com/353/ (tip: open an interactive Python session and type "import antigravity")
https://xkcd.com/378/ (tip: open emacs, hit Alt-x, type "butterfly", and hit Enter)
https://xkcd.com/1168/
https://xkcd.com/1171/

There are probably other ones I'm forgetting...

whm1974 wrote:
On another note it seems that some people think that C/C++ are dying programming languages and everybody should simply quite using them and switched to newer and more modern languages. :roll: I remember all of the hype Java had back in late 90's about how it is going to replace all other languages because developers can "Write once, Run Everywhere".

For certain segments, it is dying. Hardly anyone writes server-side web code in C/C++ these days, for example. As I've noted previously, C has just moved down the stack, taking on a lot of roles previously filled by assembly language (systems programming and embedded). And C++ is moving down into areas which have traditionally been C (high performance applications and systems programming), and (I suspect) winning some market share back from Java too, now that C++11 has added more modern features to the language.
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:11 pm

Aren't games still heavily developed using C++, especially AAA titles that bring high end gaming machines to their knees and make them beg for mercy?
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:12 pm

whm1974 wrote:
Aren't games still heavily developed using C++, especially AAA titles that bring high end gaming machines to their knees and make them beg for mercy?

That would fall into the "high performance applications" bucket IMO. FPS type games would be called "soft real-time" in the terminology of real-time systems programming -- i.e., missing a scheduling deadline degrades the user experience (by causing frame rate hitches and/or lag), but does not result in a fatal application error.

This is in contrast to "hard real-time", where failure of the software to react in a timely manner could cause a catastrophic systems failure, e.g. loss of control of a fly-by-wire aircraft, rocket engine exploding, nuclear reactor meltdown, etc.
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:20 pm

just brew it! wrote:
whm1974 wrote:
Aren't games still heavily developed using C++, especially AAA titles that bring high end gaming machines to their knees and make them beg for mercy?

That would fall into the "high performance applications" bucket IMO.

I was looking at the Godot game engine very early this morning and I might use that when I start learning C++ for practice:
https://godotengine.org/

Now I'm wondering if should have started with C++ instead as writing my own games is something I also want to do as well. Oh well I already started with C and gotten the ball rolling.
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:27 pm

whm1974 wrote:
I was looking at the Godot game engine very early this morning and I might use that when I start learning C++ for practice:
https://godotengine.org/

Now I'm wondering if should have started with C++ instead as writing my own games is something I also want to do as well. Oh well I already started with C and gotten the ball rolling.

There are some people who would indeed argue for going straight to C++. But it is an awful lot to absorb at once; even as a seasoned developer, I'm still trying to wrap my brain around some of the more advanced C++11 concepts.

My advice would be to stick with C for now to keep yourself from getting overwhelmed. C++ is close to a proper superset of C, so it's not like the effort is being wasted. If you eventually do move on to C++, nearly everything you're learning now will still be useful.

Earlier versions of C++ were a relatively thin OOP wrapper around C. Class methods in C++ were essentially coded using C (with a few extensions). You can in fact still code C++ that way, but later versions of the standard are moving towards encouraging more of a "functional programming" model.
Nostalgia isn't what it used to be.
 
whm1974
Gerbil Elder
Topic Author
Posts: 5466
Joined: Fri Dec 05, 2014 5:29 am

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:33 pm

just brew it! wrote:
whm1974 wrote:
I was looking at the Godot game engine very early this morning and I might use that when I start learning C++ for practice:
https://godotengine.org/

Now I'm wondering if should have started with C++ instead as writing my own games is something I also want to do as well. Oh well I already started with C and gotten the ball rolling.

There are some people who would indeed argue for going straight to C++. But it is an awful lot to absorb at once; even as a seasoned developer, I'm still trying to wrap my brain around some of the more advanced C++11 concepts.

My advice would be to stick with C for now to keep yourself from getting overwhelmed. C++ is close to a proper superset of C, so it's not like the effort is being wasted. If you eventually do move on to C++, nearly everything you're learning now will still be useful.

Yeah I was thinking the same thing, that once I learn and understand C [then everything else becomes much easier.][/i]
 
just brew it!
Gold subscriber
Administrator
Posts: 49738
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: GCC errors with compiling C code.

Sat Nov 11, 2017 1:59 pm

Indeed. Learn to walk before you try to compete in a triathlon!

(Modern C++ is a mash-up of procedural, object-oriented, and functional programming concepts, so I don't think the "triathlon" analogy is very far off base...)
Nostalgia isn't what it used to be.
  • 1
  • 3
  • 4
  • 5
  • 6
  • 7
  • 10

Who is online

Users browsing this forum: No registered users and 1 guest