struct/class '**something**' was previously declared as a class/struct

Reporter: RodrigoCard  |  Status: open  |  Last Modified: September 30, 2016, 10:38:06 AM

I got tons of warnings like these polluting the log, any reason for letting this as is?

warning: struct 'blablabla' was previously declared as a class [-Wmismatched-tags]
      friend struct blablabla;

warning: class 'blebleble' was previously declared as a struct [-Wmismatched-tags]
      private: friend class blebleble;

do you have any style preferences to guide when to use structs or classes?

RobertBColton  
I don't mean to be facetious, but haha what file is that coming from? Can you show the larger log? I have never seen this before and a search for blablabla in the repository yields nothing. Can you show the larger log so I can see what part of the compile phase it is?
https://github.com/enigma-dev/enigma-dev/search?utf8=%E2%9C%93&q=blablabla

And really ENIGMA has been ok with using structs, that's Josh's style. He recently turned one of the iterator structs into a class in #999 though to make the data private so he could see where a pointer was being corrupted. So temporarily using structs is ok until there is an issue in which case it may be replaced by a class.

I guess it really depends on the situation, but really just need to use good judgement.

RodrigoCard  

haha sorry, I just write random words (blah blah blah) to represent dozens of different but identical warnings from a really big log, I will post the complete log here

RodrigoCard  

Here, the full 116kb log: https://dl.dropboxusercontent.com/u/14890209/dev/enigma-log-20160930.txt

please ignore the linker error at the end, it is unrelated.

and sorry for the bad communication before.

as you can see there are many similar warnings in different files.

RobertBColton  

It's fine but just a couple of things. I don't know XCode or Mac at all. When did this start/what were you trying to do? I do not see these warnings on Windows and nobody has reported them on Linux, but they look like legitimate warnings @JoshDreamland should address. They may have actually already been fixed in a newer JDI, which is not in ENIGMA (it resides on Josh's personal GitHub account). ENIGMA still uses a really old version of it. Before you did whatever is causing this, did you have ENIGMA working ok?

JoshDreamland  

Those warnings are super pedantic and don't indicate an actual problem, but yes, it would be better if the code were not doing that.

RobertBColton  

I want to know why the build fails though from just warnings. I don't actually know what this ticket is really about.

JoshDreamland  

The build failure is from an unrelated link error. He already said it was safe to ignore it.

Anyway, to answer the original question, my preference is to use struct when handing around raw data with no member functions (I'll budge on trivial member functions, like length() on a Line struct). When you have full-blown functionality like insert(), use class.

In JDI, if I said friend struct and it's griping, I'd just change it to friend class. At the point where 19-year-old me thought it should be a class instead of a struct, it should be a class.

RobertBColton  

Every bone in my body ache's right now, I had a fever all night last night I felt like I was on the surface of the sun.

JoshDreamland  

Get some sleep.

RobertBColton  

You are the stuff dreams are made of.

Please sign in to post comments, or you can view this issue on GitHub.