« first day (4067 days earlier)      last day (864 days later) » 

4:20 AM
 
 
7 hours later…
 
3 hours later…
2:38 PM
Hi, I have a possibly trivial question about coding style. I need to encode functions int -> int, and I'm using std::unordered_map<int, int> to do it. Should I use typedef to give this type a name? There is a good candidate for the name (these functions represent something meaningful in some system), but I've read somewhere now that using typedef is discouraged unless it's for function pointers?
 
@corazza if it's C++ just use type aliases
better syntax for essentially the same thing
 
yes it's c++
I'm not sure what that is but I'll look it up
 
typedef with a more intuitive syntax
 
using myType = std::unordered_map<int,int>;
 
if it's the same thing, I might go with typedef because the rest of the team is even less familiar with c++, but is familiar with c-style typedef
although I think the type alias syntax is more intuitive actually now that I know about it:D
 
2:42 PM
@Feeds Even as a simple observer it is stressful ^^'
 
also-- another question. I capitalize my structs/classes (Name instead of name), it's then good practice to also capitalize the typedefs/aliases, right?
 
I would say so
 
cool ty
 
Depends on your local style guide
There's so much variance that the best you can do is having a company style guide and follow it
 
in this case the locale is my own head, because it's a uni project I'm working on alone atm:D I'm just trying to get a picture of what people think about these things to work them in my routine ig
 
2:49 PM
oh
I guess it depends on the project
Mines are generally designed after standard library components, so I mostly follow standard library naming practise
 
I think I default to upper casing my types because of experience in other languages, and because I find it useful to differentiate them from the library ones. but yeah I haven't thought it out, and thankfully it's not important now:D
 
3:07 PM
using my_new_type = std::unordered_map<int, int>;
I suggest to use something like that
 
 
9 hours later…
11:47 PM
(removed)
 

« first day (4067 days earlier)      last day (864 days later) »