Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
At least if you find print offers a big performance difference, you only have to update it in one place 😉
-
ddephor45127yYeah, comment would be nice.
But sometimes you need strange stuff, if you cannot figure out or the eliminate the root cause.
I once had to create two functions in a proprietary scripting language, just because the implicit conversion string<->int didn't work in all places and this was the workaround to force it:
int toInt( int value ) { return value; }
string toString( string str ) { return str; }
Looks stupid, but worked.
Or another example that was based upon spontaneous errors in the communication to an NXP chip after updating the GNU toolchain:
void wasteTime( int nops ) {
for(int i=0; i<nops; i++ ) {
asm( "NOP" );
}
}
I still don't know why this helped, and what difference the toolchain made. The old toolchain didn't need that and I even tried to diff the assembler output of the two toolchains, without success. Also looks stupid, but after some hours of pointless debugging, that stupid piece of code helped.
At least I left comments to explain my foolishness. -
pajaja17337y@ddephor Trust me, when you see the rest of the code it becomes obvious that this is just an 'accident' :D
Related Rants
I have a lot of interesting code snippets from some kind of inhouse CRM/billing software, but for now let's look at this very useful PHP function.
undefined
wk58