P
Pelle Beckman
Hi,
I saw this code in an earlier post
(not that there's anything wrong with it)
#include <iostream>
using std::cout;
const int hour = 3600;
const int min = 60;
class Time
{
int m_t; // member seconds
public:
Time(int t) : m_t(t)
{
...
What's up with Cpp-stuff like this?
What's so much more practical with consts vs. #defines?
It uses unnecessary space, and the typical use (at least for me)
are _simple_ constants like SCREEN_WRES, SECS_IN_HOUR, etc.
Yes, there are issues when formatting, data types, etc. can
can get nasty with defines, but do professional programmers like _you_
ever have problems with defines?
I'm actually wondering.
-- Pelle
I saw this code in an earlier post
(not that there's anything wrong with it)
#include <iostream>
using std::cout;
const int hour = 3600;
const int min = 60;
class Time
{
int m_t; // member seconds
public:
Time(int t) : m_t(t)
{
...
What's up with Cpp-stuff like this?
What's so much more practical with consts vs. #defines?
It uses unnecessary space, and the typical use (at least for me)
are _simple_ constants like SCREEN_WRES, SECS_IN_HOUR, etc.
Yes, there are issues when formatting, data types, etc. can
can get nasty with defines, but do professional programmers like _you_
ever have problems with defines?
I'm actually wondering.
-- Pelle