for(int i=0; i<str_length; i++){
switch(str[i]){
case 'a':
//do something
break;
case 'A':
//do something
break;
case 'b':
//do something
break;
case 'B':
//do something
break;
case 'c':
//do something
break;
case 'C':
//do something
break;
case 'd':
//do something
break;
case 'D':
//do something
break;
case 'e':
//do something
break;
case 'E':
//do something
break;
case 'f':
//do something
break;
case 'F':
//do something
break;
case 'g':
//do something
break;
case 'G':
//do something
break;
case 'h':
//do something
break;
case 'H':
//do something
break;
case 'i':
//do something
break;
case 'I':
//do something
break;
case 'j':
//do something
break;
case 'J':
//do something
break;
case 'k':
//do something
break;
case 'K':
//do something
break;
case 'l':
//do something
break;
case 'L':
//do something
break;
case 'm':
//do something
break;
case 'M':
//do something
break;
case 'n':
//do something
break;
case 'N':
//do something
break;
case 'o':
//do something
break;
case 'O':
//do something
break;
case 'p':
//do something
break;
case 'P':
//do something
break;
case 'q':
//do something
break;
case 'Q':
//do something
break;
case 'r':
//do something
break;
case 'R':
//do something
break;
case 's':
//do something
break;
case 'S':
//do something
break;
case 't':
//do something
break;
case 'T':
.........
}
}
Name:
Anonymous2009-05-24 18:09
>>19
oh noes 36 bytes, whatever will we do says the person who spent a week shrinking his Uni project to a quarter it's original size
Name:
Anonymous2009-05-24 19:49
>>22
This one time I developed a game in Sepples for a Uni project. I ended up running out of time so I tried to focus on finishing the actual game. Even though I did complete it, I ended up turning it in with 29 memory leaks still there and I feel kind of bad about it :(
>>27 Length-prefix is obviously superior.
Ironic, thats exactly how C string handling works in my string struct. I think it's you who doesn't understand the basic idea of C in that there is nothing you can't do yourself.
>>28
So what you're saying is that it has nearly zero value to the modern programmer. If it didn't allow such tight control over memory, it would definitely be worthless for any practical purposes.
Name:
Anonymous2009-05-25 4:15
>>27
What's wrong with building web servers in Lisp? Edi's even done all the work for you.
Anyone who doesn't use allman-based style is a flaming cretin. But I guess some people prefer to line up their closing braces not to their respective opening braces, but to something like the fuqin int fun.
>>44
Aww, I already had a post that involved a chest of cocks and a dicksage, but then I clicked the link and realised that you use the correct indention. :(
Name:
Anonymous2009-05-25 13:41
int
is_inset(s)
const char *s;
{
while (*s)
{
if (!(*s>='a' && *s<='z' || *s>='0' && *s<='9'))
{
return 0;
}
++s;
}
return 1;
}
Fixed you're code.
Name:
Anonymous2009-05-25 13:43
>>35 is the indentation style that my highschool C teacher taught to the class, and they always asked me help fix their code whenever the screwed it up. Because of that I have always and will forever associate that style with complete idiots.
Name:
Anonymous2009-05-25 13:48
>>47 WHAT
THE
FUCK
BRO
Code is supposed to look tidy.
Name:
Anonymous2009-05-25 13:56
>>49
I messed up that last brace, but with that fixed it would look beautiful.
Name:
Anonymous2009-05-25 13:58
>>48
The braces on their own lines make simple functions too long but every other style looks weird to me. I'd rather FOIC than C, but sometimes C is best.
Name:
Anonymous2009-05-25 14:12
>>51
For very short functions (like inline ones) I use
int max(int a, int b) {
return (a > b ? a : b); }
Nearly like FIOC.
>>53-55
Clarification required: is the opening brace placed after the end of the line following it, or after the longest line in the block following it?
Name:
Anonymous2009-05-25 14:40
>>52
You know you can skip the braces if you only have one line, right?
Name:
Anonymous2009-05-25 14:43
>>57
I know you can do that when you have if statements etc., but is it possible with functions?
Name:
Anonymous2009-05-25 14:44
>>56
The latter.
int
main
(
int argc,
char **argv
)
{
return 0;
}