Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Jun 2004
Offline Last Active Today, 02:16 AM

Posts I've Made

In Topic: c++: replace word in char array?

13 July 2016 - 10:08 AM

Sounds like a homework assignment to me, so I'll try to be vague.


If you are not allowed to use existing helper functions, you have to implement your own.


To solve this you need 3 functions:

1) find the length of a string, like strlen

2) find a string inside a string, like strstr

3) copy a part of one string to another, like strncpy


If you are stuck with the interface you described and have to work with that one char array given, you'll need to be extra careful not to stomp over input you still need.


I hope that helps.

In Topic: how could unlimited speed and ram simplify game code?

13 March 2016 - 12:17 PM

Maybe frame the question in another way: Many programmers, gameplay or otherwise already act as if there was more performance and memory than there actually is. A tiny group of programmers then have the ungrateful, but often fun job to bridge between perceived reality and apparent reality. These programmers would not be needed anymore. ;)

In Topic: Class 'Virtual' question

04 March 2016 - 12:46 PM

Yes you can!!

Indeed, that's a case of B hiding something it inherits from A. It's not good practice because it can be rather confusing. Some compilers will emit a warning.

In Topic: Class 'Virtual' question

04 March 2016 - 04:19 AM

You are mixing up nomenclature here, making your question hard to answer.

So let's get that out of the way by making two definitions:
Type: a class, struct or simple type (int, float,...) definition
Instance: a named, usable instance of a type

Now the answer:
Types can be derived from other types, and when that happens, members can be added, overridden and hidden, but never renamed or removed.

Instances are of exactly one type and contain exactly what is defined by the type definition, not more, not less.

I hope that helps!

In Topic: make c++ more like glsl

21 February 2016 - 05:50 AM

Here's a long discussion on that topic with a couple of possible solutions.




But the bottom line is that there is no good way to do it in C++ without extending the language.