Announcement

Collapse
No announcement yet.

Constants over Vars in Unrealscript?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Constants over Vars in Unrealscript?

    I know the obvious difference, in that one can change during gameplay and the other is constant.

    However i tend to use vars more often (even when they never change), simply because I can specify explicit types, rather than constants seeming to imply the type based on the value assigned.

    For example if i declare
    Code:
    const MyConst = 222
    Will the compiled code interpret this as a byte or an int?

    Or if I declare
    Code:
    const MyConst =  222.0
    Would it be considered a float?

    Does anyone know if there is any performance cost of using constants over variables?

    Cheers
    Last edited by Coldscooter; 10-04-2019, 03:21 PM.

    #2
    you have to define them before use, I know you know that. const int MyConst.

    For performance local variables over constants.

    Comment


      #3
      Hmmm, this is unusual that most consts in the base unrealscript code do not specify a type (although i see some do).

      Also gamepainters, what makes you believe vars are more performant than consts? I would assume the opposite if anything at all.

      Comment


        #4
        less intructions. = better performance.

        Comment

        Working...
        X