Jump to content

Does programming languages prefer higher clocked CPUS with less cores or more cores just a lower clock speed?

18 hours ago, kirashi said:

Correct - the web development I do is mostly frontend, and mostly focused on design and layout to provide users with decent navigation and content. There is some logic, especially when I take an existing code snippet and re-factor it to suit my needs at the time, but I don't have to deal with memory management or low-level code that gets compiled before it can run. I'm a high level kind of guy, preferring languages that run through an interpreter at runtime instead, such as PHP, Python, basic Javascript like jQuery, or hell even DOS Batch scripts and PowerShell.

Even in something like C, the only time you're really touching lower level code is if you're programming for an embedded system. And even then, you make damn sure not to use malloc and free (i actually consider it "doing it wrong" if you use malloc/free in an embedded system). If you're developing application software, then you should be finding libraries that helps manage lower level operations for you.

Link to comment
Share on other sites

Link to post
Share on other sites

On 12/26/2017 at 10:14 PM, Hotseff said:

I knew what everything did I just had to do it because my teacher wanted it at one point done that way 

What? The teacher wanted it all in one file? It's Java! Why wouldn't they want it to be object oriented with multiple files? At least with Python it kind of makes sense to put everything in a single file I don't see any reasonable reason to do so in Java. Although for my Principles of Operating Systems class, our solutions were to be in a single cpp file... which drove me insane since header files are amazing and make figuring out how everything works much easier. Although none of the questions were difficult enough to require more than a single cpp/h pair.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, ElfFriend said:

What? The teacher wanted it all in one file? It's Java! Why wouldn't they want it to be object oriented with multiple files? At least with Python it kind of makes sense to put everything in a single file I don't see any reasonable reason to do so in Java. Although for my Principles of Operating Systems class, our solutions were to be in a single cpp file... which drove me insane since header files are amazing and make figuring out how everything works much easier. Although none of the questions were difficult enough to require more than a single cpp/h pair.

Because I'm in high school and that was in Computer Science 1 so we weren't taught how to do that. Also I was talking about the comments on what things did for one warm-up was needed though some were from a simple Javafx Application he provided and I just stripped out what we did not need.

Edited by Hotseff
Should of read the quoted post more thoroughly before my 1st version
Link to comment
Share on other sites

Link to post
Share on other sites

On 12/26/2017 at 3:19 PM, kirashi said:

Correct - the web development I do is mostly frontend, and mostly focused on design and layout to provide users with decent navigation and content. There is some logic, especially when I take an existing code snippet and re-factor it to suit my needs at the time, but I don't have to deal with memory management or low-level code that gets compiled before it can run. I'm a high level kind of guy, preferring languages that run through an interpreter at runtime instead, such as PHP, Python, basic Javascript like jQuery, or hell even DOS Batch scripts and PowerShell.

Considering OO is a massive part of Java it doesn't make sense why you weren't taught that before being given a fairly large assignment. It's like a "you must know this before you can do anything" kind of thing. Otherwise they really should have used a different language (ie Python).

 

On 12/26/2017 at 3:19 PM, kirashi said:

Correct - the web development I do is mostly frontend, and mostly focused on design and layout to provide users with decent navigation and content. There is some logic, especially when I take an existing code snippet and re-factor it to suit my needs at the time, but I don't have to deal with memory management or low-level code that gets compiled before it can run. I'm a high level kind of guy, preferring languages that run through an interpreter at runtime instead, such as PHP, Python, basic Javascript like jQuery, or hell even DOS Batch scripts and PowerShell.

If you use an IDE compiling and running the program is a 1 step process. Although for more complex stuff you'll still need to know how compiling, linking, etc work if you're doing simple stuff the IDE can often do most of those things automatically. Basically it can be just as much effort to run a compiled language as it is to run an interpreter language... so I'm really not seeing the argument for using an interpreter over a compiled language.

 

As for memory management I'm basically completely oblivious to it and yet I've been able to make some pretty cool stuff ranging from a 3D model viewer to a ray tracer. Now it's possible I was accidentally managing memory as there was a part where I had to delete stuff in order for things to work but basically all of my deconstructers are empty.

 

Also on the topic of interpreter languages, I assume you really like Haskell then? It's got both a compiler version and interpreter version and what's awesome about Haskell is that as long as it compiles/loads into the interpreter it will run. There won't be any weird run time error although there might be a logic error but that's on the programmer.

Link to comment
Share on other sites

Link to post
Share on other sites

20 hours ago, ElfFriend said:

Now it's possible I was accidentally managing memory as there was a part where I had to delete stuff in order for things to work but basically all of my deconstructers are empty.

cpp?

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

23 hours ago, ElfFriend said:

As for memory management I'm basically completely oblivious to it and yet I've been able to make some pretty cool stuff ranging from a 3D model viewer to a ray tracer. Now it's possible I was accidentally managing memory as there was a part where I had to delete stuff in order for things to work but basically all of my deconstructers are empty.

The only time you really have to touch memory management like that is if you dynamically allocate something. And all you really have to do is make sure each allocation has a corresponding deallocation call. If you weren't dynamically allocating anything, then there's nothing to worry about. I believe all destructors do is for some sort of final function call to the object to perform operations that need to be done before it's reaped. So you should usually have all your deallocation calls there (unless there were local scope ones)

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, M.Yurizaki said:

The only time you really have to touch memory management like that is if you dynamically allocate something. And all you really have to do is make sure each allocation has a corresponding deallocation call. If you weren't dynamically allocating anything, then there's nothing to worry about. I believe all destructors do is for some sort of final function call to the object to perform operations that need to be done before it's reaped. So you should usually have all your deallocation calls there (unless there were local scope ones)

Dont do that, use RAII (resource acquisition is initialization) instead.

Use smart pointers and STL containers.

Any “new” call can be replaced by a unique pointer so that you dont have to worry about not forgetting to call delete.

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, mathijs727 said:

Dont do that, use RAII (resource acquisition is initialization) instead.

Use smart pointers and STL containers.

Any “new” call can be replaced by a unique pointer so that you dont have to worry about not forgetting to call delete.

And if you're not using C++?

 

Dynamic allocation is a thing in C too.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, M.Yurizaki said:

And if you're not using C++?

 

Dynamic allocation is a thing in C too.

Convert your code to C++.

There is no reason to use C instead of C++ (even in embedded)

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, M.Yurizaki said:

Why?

Way cleaner code, the standard library, no memory leaks.

Features like: templates, iterators, lambda functions, operator overloading, virtual functions, auto keyword.

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to comment
Share on other sites

Link to post
Share on other sites

26 minutes ago, mathijs727 said:

Way cleaner code,

Arguable at best.

26 minutes ago, mathijs727 said:

the standard library

Which C also has. A different one obviously.

26 minutes ago, mathijs727 said:

no memory leaks.

Depends on the C++ standard version you're using and how badly you write your code.

26 minutes ago, mathijs727 said:

Features like: templates, iterators, lambda functions, operator overloading, virtual functions, auto keyword.

If you need those features, then sure, C isn't the right tool for the job.

 

I see no technical reason to use C over C++. Especially when I don't have need of any of its features.

Link to comment
Share on other sites

Link to post
Share on other sites

20 hours ago, straight_stewie said:

cpp?

C++ files tend to end in .cpp (at least when it's not a header, .cxx or some other less comon c++ file extension) so I use the two interchangeable since it's easier to hit 2 p's than 2 +'s. (Surprisingly using cpp instead of c++ works fine when searching for help)

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, ElfFriend said:

C++ files tend to end in .cpp (at least when it's not a header, .cxx or some other less comon c++ file extension) so I use the two interchangeable since it's easier to hit 2 p's than 2 +'s. (Surprisingly using cpp instead of c++ works fine when searching for help)

I'm aware. I was asking if that's what language you were referring to in that reply lol. 

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, straight_stewie said:

I'm aware. I was asking if that's what language you were referring to in that reply lol. 

yes, sorry I forgot what I wrote initially and didn't reread it :P 

Link to comment
Share on other sites

Link to post
Share on other sites

17 hours ago, M.Yurizaki said:

Arguable at best.

Which C also has. A different one obviously.

Depends on the C++ standard version you're using and how badly you write your code.

If you need those features, then sure, C isn't the right tool for the job.

 

I see no technical reason to use C over C++. Especially when I don't have need of any of its features.

You would argue that your projects dont need any C++'s containers, iterators and algorithms.

I find that in all of my projects I use std::vector and std::sort .

And there is a need for std::unique_pointer in literally every project.

 

I believe that features like lambda and range based for loops make a significant improvement to the code quality.

It also makes is much easier to read for outsiders (people that look at your project for the first time) and to understand what is going on.

This also helps with verifying that code is correct (because it is written like an algorithm )

 

Also writing parallel code is way easier in C++:

tbb::parallel_for<size_t>(0, 20, [&](size_t i) {
  // Parallel for loop
});

Compared to writing a struct to store all local data with a seperate function that takes that struct as input.

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, mathijs727 said:

I find that in all of my projects I use std::vector

It's funny how underused that still is. I still see lots of programmers trying to manually allocate/manage memory inside their objects and then mess up the rule of 3 (5).

As if they don't understand 'std::vector' gives you flawless copy/move construction/assignment for free.

 

Sadly, C++ compilers are not available on a lot of embedded devices.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×