x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Const Prop Omitted from UHT for Class Member Vars

Hi,

Looking at the UHT parsing code, it cannot handle Const UProp declarations in member vars. I am under the assumption that this is a bug since none of the documentation mentions this restriction. I checked the version of the HeaderParser file available on GitHub and it appears that it has not been addressed, yet.

Thanks

Product Version: Not Selected
Tags:
more ▼

asked Jun 10 '14 at 03:52 AM in C++ Programming

avatar image

AStarkey
1 1 2 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi,

What property type are you trying to declare? We do support:

 const UObject* Value;

We do not support (but we do handle it in UHT with a message 'Inappropriate keyword 'const' on variable of type...')

 const float Value;

We're aware there's an issue with (as in it doesn't tell you what's wrong exactly, there's a ticket to fix thius):

 UObject const* Value;

Unfortunately we're probably never going to make UHT as good as any C++ compiler, there's some limitations we're aware of but we're trying to make it better. Also note that 'const' values do not necessarily mean much when it comes to UObjects, You will always be able to set them through reflection (UProperties etc). We only care for VisibleAnywhere, EditAnywhere UPROPERTY keywords in the editor.

more ▼

answered Jun 10 '14 at 10:43 AM

avatar image

robert.manuszewski STAFF
318 8 3 9

avatar image AStarkey Jun 10 '14 at 01:19 PM

Hi,

I guess what I meant to say was specifier. This is akin to what I was attempting to do:

 UPROPERTY(Const)
 uint32 Value;

According to the documentation, this should be valid. https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Properties/Specifiers/Const/index.html

I was hoping that this would enforce const-ness through the engine, post initialization.

Thanks

avatar image robert.manuszewski STAFF Jun 10 '14 at 01:54 PM

I guess maybe that's not mentioned there but that's an 'old-style' function param specifier:

 UFUNCTION(BlueprintCallable, Category="Test")
 static void DoSomething(UPARAM(const) float Value);

And is basically the equivalent of just normal 'const float Value' these days.

avatar image AStarkey Jun 10 '14 at 01:57 PM

Ah, alright. Thanks. :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question