Language:
switch to room list switch to menu My folders
Go to page: 1 2 3 [4] 5 6 7 8 ... Last
[#] Tue Dec 20 2011 22:18:40 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Oh, ever since boost::bind (or tr1::bind, if you prefer), I love doing callbacks, and use them quite often. You can do some amazingly creative things with bind.

[#] Tue Dec 27 2011 13:44:33 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

http://events.ccc.de/congress/2011/Fahrplan/events/4817.en.html

whew. creating sort of a programming language backend, that takes format string exploits from carefuly handcrafting to an automated generation of code therefore..



[#] Tue Dec 27 2011 16:59:39 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


I do not use printf-style formattings (outgoing or incoming) for this very reason in my C++ work. I prefer to use input streams, regular expressions, and/or a kind of BNF parser that boost offers to parse input, depending on what I need to do.

[#] Tue Dec 27 2011 17:12:01 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

the webcit templating engine also offers an effective way around.

it merely uses hard coded formatstrings to add a %d to strings.

though i'm not yet done with templating everything ;-)



[#] Wed Dec 28 2011 09:55:45 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Well, that's another thing. I try not to have any formatting strings 'formatted' that come from users, unless I do so with intention... and even then, I use my own formatting language (usually simple replacement, like ${VARNAME} getting translated to the value of VARNAME).

[#] Mon Jan 09 2012 22:49:30 EST from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Arbitrary format strings just invite abuse, of course. I think some of the compilers now throw a warning if you try to supply a variable as a format string.

[#] Wed Jan 11 2012 18:49:21 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

heh, just found in the RSS feed:

As mobile devices become a major development platform, scripting languages are beginning to fall out of favor.

http://drdobbs.com/mobile/232400093

though there still are c-carpet and java on phones. well. I wouldn't exactly call that "scripting languages are beginning to fall out of favour"



[#] Thu Jan 12 2012 14:53:47 EST from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

it also depends on the cost of the decision evaluated by the if; i.e.
strcmp's aren't that cheap if its a dozend of them in a row.

ahhh... see... but they are.
count the cycles of the worst case scenario, then divide that by the processor speed and see how many zeroes are to the right of the decimal point. You might be surprised.

[#] Thu Jan 12 2012 14:55:52 EST from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Basically, you'd encapsulate the behavior for each different if-else

into a separate object, one for each "branch." Then you'd just pass
the appropriate object into your readloop() function. The problem I

this would end up about the same as the hash lookup, except it's broken into two parts. The lookup in the hash would be like the lookup in the virtual function table and making the right object, would be like building the hash.

[#] Thu Jan 12 2012 14:57:51 EST from Ford II @ Uncensored

Subject: Re: if statements == goto?

[Reply] [ReplyQuoted] [Headers] [Print]

Agreed.  A switch statement is less evil compiled.

A switch statement is brilliantly efficient, but I thought we were talking about a pile of string compare ifs.

[#] Thu Jan 12 2012 14:59:48 EST from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Dec 19 2011 11:56pm from ax25 @uncnsrd
Would love to do a day of pair programming with you fleeb!  (Hope
that does not sound to gay!)--- PPS - hope you are not gay,  I am
from a generation and don't think it is.

Ax25

Sorry, that had me laughing a lot. :-)

[#] Thu Jan 12 2012 15:03:25 EST from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

A last work about ifs versus switch, the downside of switch is that it has to be one unbroken code block.
A string of ifs can be broken out into separate functions grouped by category.
if (handlemathfunctions() == 0)
if (handlestringfunctions() == 0)
if (handlekitchensinkfunctions() == 0)
return "command not found.";

and each of those three functions can have strings of ifs in them.

[#] Thu Jan 12 2012 15:39:57 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

hm, ford a little late to the party? or some bug?



[#] Thu Jan 12 2012 15:44:05 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Ford is a bug.

[#] Thu Jan 12 2012 16:17:26 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Volkswagon's Ford Bug. Test drive one today.

[#] Thu Jan 12 2012 16:46:53 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


TMDFB III

[#] Fri Jan 13 2012 13:52:08 EST from ax25 @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

 

Thu Jan 12 2012 02:59:48 PM EST from Ford II @ Uncensored
Dec 19 2011 11:56pm from ax25 @uncnsrd
Would love to do a day of pair programming with you fleeb!  (Hope
that does not sound to gay!)--- PPS - hope you are not gay,  I am
from a generation and don't think it is.

Ax25

Sorry, that had me laughing a lot. :-)

I need to lay off the sauce when posting in future :-)



[#] Fri Jan 13 2012 14:19:09 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


It was one of the better moments in this room.

[#] Sat Jan 14 2012 06:08:58 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

http://gnublin.org/index.php?title=Hauptseite

tiny little ARM computer, where you might be able to understand the hardware and do some coding..



[#] Wed Jan 18 2012 11:41:42 EST from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Neat, but I think I'm going to get a Raspberry Pi instead. Of course I'll probably do something totally stupid like put it in a rack mount chassis.

I've always been looking for a cheap way to turn my television into a digital media terminal. Most new televisions have this kind of thing built in but I've got a 32" CRT that isn't getting replaced anytime soon. And besides, most of the new TV's only play your own content; I want to play YouTube.

Go to page: 1 2 3 [4] 5 6 7 8 ... Last