« first day (3075 days earlier)      last day (1870 days later) » 

4:30 AM
I have been camping in the true wildness many times before, never got bitten by fleas or mites. Visited farm land a few times, not only got bitten over the place. But also brought some home and continue to get bitten a few days after.
 
4:42 AM
And where is the draught promised? Continuous rain for 3 days with no clear days in sight.
 
5:03 AM
Some people have an allergic reaction to fleabites
That means some people do not have allergic reaction to flea bites ... and I am not one of them :'(
 
5:17 AM
Good thing is that I have a large wardrobe, I can keep 4-5 days worth of clothing and bedding marinated in soupy water and still have clean clothes to wear for the next 14-15 days. (Dryer's broken and sits in the garage).
 
 
3 hours later…
7:53 AM
@LucDanton could you please explain this?
 
 
2 hours later…
9:36 AM
 
 
2 hours later…
11:25 AM
OMG young me ... from family album, taken when I was only 9-10 yo.
 
 
2 hours later…
 
4 hours later…
4:54 PM
 
 
4 hours later…
8:26 PM
anyone got any experience with data structures and algorithms based interview questions?
 
user7659542
8:49 PM
@Permian nope
 
9:44 PM
no
 
user7659542
I feel like so many people use macro s where they simply could use an inline function instead to guarantee type safety
 
user7659542
So far I can t come up with a case where a macro is the go-to solution
 
user7659542
I felt like we hit the bottom when seeing this:
 
user7659542
#define INIT_STRUCT_ZERO(_struct_) memset(&_struct_, 0, sizeof(_struct_));
 
user7659542
what s the point of defining a macro just for this?
 
9:50 PM
@traducerad When comparing against normal inline functions where there's no guarantee of inlining I've seen compilers not inline. force-inlining works much better.
Other than that, the only case where I've see a macro function do better is that certain compilers lose aliasing information across function boundaries - even if inlined.
So it inhibits optimization.
But that's a compiler shortcoming rather than a language issue.
 
user7659542
@Mysticial looks to me like we can all just stop using macros
 
@Mysticial But if the compiler does not inline, does that mean that you should inline? I'm not saying that the compiler is perfect here, but presumably there are situations where not inlining is the better decision
 
@Puppy There's enough cases where the compiler fails to inline when it should.
As in - there's a large performance difference in inlining.
 
I know there's a large performance difference
but if memory serves excessive inlining can be bad too
 
Some arbitrary compiler heuristics also get in the way. IIRC, MSVC never inlines more than 5 layers deep unless you force inline.
 
9:55 PM
something about icache?
 
It's quite easy to exceed 5 levels if you have multiple layers of getter functions and "zero-overhead" wrappers/abstractions.
 
user7659542
@Puppy so many people always think the compiler is always 100% right. When I graduated I always thought people working in the industry were incredibly clever and always knew what they were doing. After a couple of years I realized there are shitload of incompetent people out there with many years of experience under their belt.
 
user7659542
Some of those people may be working on compilers as well.
 
@Puppy The Intel compiler has the opposite problem. No so much for icache, but because it makes the resulting binaries too fucking big.
 
the compiler isn't 100% right but defaulting to the position that the compiler is right is usually a pretty good start
in this specific case I'm pretty sure that it's a tradeoff and whilst usually more inlining is good, there definitely are possibilities where not inlining is better
so force inlining everything may not be the winrar
 
9:57 PM
You definitely shouldn't force-inline everything.
It should be used carefully.
As well as force-no-inlining.
 
user7659542
glad to see nobody is claiming macros are the biggest thing since sliced bread
 
I particularly noticed that the documentation on force-inline states that it doesn't actually guarantee inlining ;p
anyway good night
 
user7659542
night
 
Say you have a stack of function calls. The compiler may decide to inline every other frame because those are small. But with two levels, it's too large to further inline. If you want to switch the parity, you'll need to explicitly do force-inline/force-no-inline.
@Puppy The compiler usually warns or errors when that happens.
A case for no-inline that I do is error-handling code. I typically force-no-inline those since performance doesn't matter and I just want the compiler to jump over the call. Otherwise, it gets inlined and you litter the caller with tons of shit that never gets run, but clogs up the icache on site.
@Puppy night
@traducerad There isn't much left for macros that behave like functions. But there is for unifying compiler-specific stuff.
#define FORCE_INLINE __attribute__((always_inline))  //  GCC
#define FORCE_INLINE __forceinline   //  MSVC
 
@Puppy Sure--if you tack forceinline on a function with (for one obvious example) recursion of indeterminate depth, the compiler is going to stop somewhere.
 
user7659542
10:06 PM
@Mysticial one of the rare cases indeed where macros are usefull
 
user7659542
but plz don't tell me you are ok with such crap:
 
user7659542
#define INIT_STRUCT_ZERO(_struct_) memset(&_struct_, 0, sizeof(_struct_));
 
@traducerad If you want to initialize a struct to all zeros, why not just Foo bar {}; and be done with it?
 
user7659542
@JerryCoffin idk, I see people doing that sort of stuff the place where I work at
 
@traducerad Sounds like they have some learning to do.
 
user7659542
10:09 PM
I d do: foo_t bar = {/*something*/};, or memset if I want to make sure the padding is 0
 
user7659542
that s it
 
@traducerad Why do you care about the padding?
 
user7659542
@JerryCoffin actually just realized this indeed isn t even about padding
 
user7659542
memset is a oneliner I can use to iinitialize all the fields
 
user7659542
I shouldnt care about the padding
 
10:10 PM
@traducerad ...which {} does just fine.
 
user7659542
@JerryCoffin you mean empty curly braces initializes all the fields to 0?
 
user7659542
TIL
 
user7659542
:p
 
user7659542
ok well no. There is another scenario where macros can be useful: when you need x-macros
 
user7659542
the couple of times I saw people using these, it resulted in them needing to type less stuff
 
user7659542
10:17 PM
something along those lines:
 
user7659542
void initfoo(void);
void initbar(void);
void startfoo(void);
void startbar(void);

#define MYMACRO(action) ##action##foo(); ##action##bar;

void main(void)
{
    MYMACRO(init);
    MYMACRO(start);
}
 
10:34 PM
@traducerad Yes (in current C++). In older C++ or C, you might have to use = {0}; instead.
@traducerad This looks pretty awful to me. init should almost certainly be a constructor, and start should probably be operator(), so this should be something like: foo f; bar b; f(); b(); If the order doesn't matter, you might be able to use foo()(); bar()(); instead though.
 

« first day (3075 days earlier)      last day (1870 days later) »