Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More requests for FreeBASIC
#11
Quote:I'm not confused. In C++, a const is a define with type checking.
Hardly. A #define is a symbol that the dumb engine of the preprocessor uses to replace code text. Constants are actual variables! They take up memory, they obey scoping rules, they're type-safe, and they're available if the compiler is smart enough to optimize them out.

Quote:However, if you create a const pointer, it allocates space and then just pretends it's special.
Const integer, const pointer - same thing. Again, they both get memory allocated because they're both variables. Const tells the compiler that the variable cannot be changed in any way. For const pointers, the pointer cannot be reseated. For pointers to const objects, the object cannot be modified in any way, but the pointer can be redirected elsewhere - How do you think we iterate through string literals?

My question was why doesn't BASIC have this capability yet? You seem to be implying that extra compile-time checking is a bad thing.

Quote:But it's only compile-time pretending, there's no speed boost to it.
Who's talking about speed issues?
stylin:
Reply


Messages In This Thread
More requests for FreeBASIC - by stylin - 11-06-2005, 09:14 AM
More requests for FreeBASIC - by Anonymous - 11-06-2005, 10:02 AM
More requests for FreeBASIC - by Jofers - 11-06-2005, 11:28 AM
More requests for FreeBASIC - by stylin - 11-06-2005, 11:40 AM
More requests for FreeBASIC - by Jofers - 11-06-2005, 11:59 AM
More requests for FreeBASIC - by stylin - 11-06-2005, 12:24 PM
More requests for FreeBASIC - by Plasma - 11-06-2005, 02:29 PM
More requests for FreeBASIC - by Dr_Davenstein - 11-06-2005, 02:53 PM
More requests for FreeBASIC - by Jofers - 11-06-2005, 07:18 PM
More requests for FreeBASIC - by marzecTM - 11-06-2005, 08:06 PM
More requests for FreeBASIC - by stylin - 11-06-2005, 09:34 PM
More requests for FreeBASIC - by Jofers - 11-06-2005, 10:59 PM
More requests for FreeBASIC - by stylin - 11-06-2005, 11:14 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)