Click here to Skip to main content
15,893,266 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Friday Programming Challenge Pin
CDP18029-Apr-15 22:26
CDP18029-Apr-15 22:26 
JokeRe: Friday Programming Challenge Pin
Joan M9-Apr-15 20:38
professionalJoan M9-Apr-15 20:38 
GeneralRe: Friday Programming Challenge Pin
C3D19-Apr-15 21:44
professionalC3D19-Apr-15 21:44 
GeneralRe: Friday Programming Challenge Pin
Thomas Daniels9-Apr-15 21:44
mentorThomas Daniels9-Apr-15 21:44 
GeneralRe: Friday Programming Challenge Pin
Mark_Wallace9-Apr-15 21:54
Mark_Wallace9-Apr-15 21:54 
GeneralRe: Friday Programming Challenge Pin
Orjan Westin9-Apr-15 22:47
professionalOrjan Westin9-Apr-15 22:47 
GeneralRe: Friday Programming Challenge Pin
PIEBALDconsult10-Apr-15 11:30
mvePIEBALDconsult10-Apr-15 11:30 
GeneralRe: Friday Programming Challenge Pin
Freak3010-Apr-15 2:47
Freak3010-Apr-15 2:47 
I only did it for IPv4 because I'm not familiar with the IPv6 format and too lazy to look it up. Poke tongue | ;-P
C++
if (bits > 31)
    throw  too many bits  blah
unsigned char buffer[4];
int i = 0;
for (; bits >= 8; i++)
{
    buffer[i] = 255;
    bits -= 8;
}
if (bits > 0)
{
    unsigned char ch = 255;
    buffer[i++] = ch << (8 - bits)
}
for (; i < 4; i++)
    buffer[i] = 0;

char result[16];
sprintf(result, "%c.%c.%c.%c", buffer[0], buffer[1], buffer[2], buffer[3]);
The good thing about pessimism is, that you are always either right or pleasently surprised.

GeneralRe: Friday Programming Challenge Pin
PIEBALDconsult10-Apr-15 11:31
mvePIEBALDconsult10-Apr-15 11:31 
GeneralHappy Friday Guys Pin
VijayPd9-Apr-15 18:24
VijayPd9-Apr-15 18:24 
GeneralRe: Happy Friday Guys Pin
King Fisher9-Apr-15 18:37
professionalKing Fisher9-Apr-15 18:37 
GeneralRe: Happy Friday Guys Pin
VijayPd9-Apr-15 19:04
VijayPd9-Apr-15 19:04 
JokeRe: Happy Friday Guys Pin
Agent__0079-Apr-15 18:38
professionalAgent__0079-Apr-15 18:38 
GeneralRe: Happy Friday Guys Pin
drummerboy05119-Apr-15 19:32
professionaldrummerboy05119-Apr-15 19:32 
GeneralRe: Happy Friday Guys Pin
HobbyProggy9-Apr-15 20:28
professionalHobbyProggy9-Apr-15 20:28 
GeneralRe: Happy Friday Guys Pin
Agent__0079-Apr-15 20:42
professionalAgent__0079-Apr-15 20:42 
GeneralRe: Happy Friday Guys Pin
Sascha Lefèvre9-Apr-15 23:22
professionalSascha Lefèvre9-Apr-15 23:22 
GeneralRe: Happy Friday Guys Pin
Agent__0079-Apr-15 23:37
professionalAgent__0079-Apr-15 23:37 
GeneralRe: Happy Friday Guys Pin
Corporal Agarn10-Apr-15 2:39
professionalCorporal Agarn10-Apr-15 2:39 
GeneralRe: Happy Friday Guys Pin
Agent__00712-Apr-15 17:23
professionalAgent__00712-Apr-15 17:23 
GeneralRe: Happy Friday Guys Pin
CDP18029-Apr-15 21:29
CDP18029-Apr-15 21:29 
GeneralRe: Happy Friday Guys Pin
den2k889-Apr-15 22:38
professionalden2k889-Apr-15 22:38 
GeneralVale Richie Benaud Pin
User 592419-Apr-15 17:22
User 592419-Apr-15 17:22 
GeneralRe: Vale Richie Benaud Pin
Stefto10-Apr-15 2:04
professionalStefto10-Apr-15 2:04 
GeneralAAPOD Pin
Sascha Lefèvre9-Apr-15 9:43
professionalSascha Lefèvre9-Apr-15 9:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.