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"

[C++ Compiler Warning Feature Request] Throw a warning if a Blueprint Library function is not marked as static ♥ Rama

Dear Epic,

When I am adding functions to my C++ Blueprint Libraries (such as my Victory Plugin)

I frequently forget to mark it as static.

 UFUNCTION(BlueprintCallable,Category="Brain Codes Library")
 void BCEditorHighlighting_HighlightReceivers();

~ Load the editor

~ Can't find it, and realize omg, I forgot to mark it as static

~ Close editor, recompile

 UFUNCTION(BlueprintCallable,Category="Brain Codes Library")
 static void BCEditorHighlighting_HighlightReceivers();


While this is entirely my fault it, it does necessitate a complete .h recompile and shutdown/reload cycle of the editor which is a rather long cycle because my C++ code base has grown quite large.

It would be lovely if you could consider throwing a compile warning if a UFUNCTION that is in a UBlueprintFunctionLibrary is not marked as static, given that it is part of the class comment itself:

 // This class is a base class for any function libraries exposed to blueprints.
 // Methods in subclasses are expected to be static, and no methods should be added to this base class.
 UCLASS(Abstract, MinimalAPI)
 class UBlueprintFunctionLibrary : public UObject



Again, this is entirely my own user error, but I am trying to help you make UE4 C++ ever more awesome and this little feature would really help me out personally

Thank youuuuu

Rama

Product Version: UE 4.12
Tags:
more ▼

asked Jun 23 '16 at 07:08 AM in C++ Programming

avatar image

Rama
10.6k 446 345 1088

avatar image ScottSpadea Jun 23 '16 at 09:38 AM

would it be possible for the UHT to automatically insert the missing Static keywords when parsing static function libraries?

avatar image Shadowriver Jun 23 '16 at 09:56 AM

I don't think UHT should interfere in code, you should be able to do what compiler let you do, warning would be satisfactory.

avatar image DesertEagle_PWN Jun 23 '16 at 01:54 PM

I'm with Shadowriver on this one. Coders need to be responsible for their code. Still a warning would be nice +1.

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

0 answers: sort voted first
Be the first one to answer this question
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