• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 04:36
CET 10:36
KST 18:36
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation4Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
[TLMC] Fall/Winter 2025 Ladder Map Rotation Mech is the composition that needs teleportation t Weekly Cups (Nov 3-9): Clem Conquers in Canada Craziest Micro Moments Of All Time? SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
Rapidtags: The Ultimate Tool for Hashtag and Keywo Terran 1:35 12 Gas Optimization FlaSh on: Biggest Problem With SnOw's Playstyle BW General Discussion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET [ASL20] Grand Finals [Megathread] Daily Proleagues
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1222 users

The Big Programming Thread - Page 847

Forum Index > General Forum
Post a Reply
Prev 1 845 846 847 848 849 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Acrofales
Profile Joined August 2010
Spain18114 Posts
February 18 2017 08:29 GMT
#16921
On February 18 2017 16:40 Hanh wrote:
Show nested quote +
On February 18 2017 16:12 Acrofales wrote:
Re Hahn: it's not true that (1) is a weaker or stronger version of (2). They say completely different things about the set. The original statement says there is no minimum element. (1) says there is a minimum element. (2) says nothing about minima, but instead says there is no maximum element. For instance, (1) is true for the set [0, 1,2], but (2) is not (and neither is the original statement).


OK, but you misquoted me. I wasn't referring to these statements.

Travis:
Show nested quote +

there exists x, such that for all y

and

for all y, there exists x


Me:
Show nested quote +

Not sure what you mean by that, the 1st statement is stronger than the 2nd. (1) is false but (2) is true.


Do you disagree with me?



Still do. They just mean something completely different.

For all dragons, there exists a fairy (that rides it). This is a true statement in our world, because there are no dragons. And thus all of them are indeed ridden by fairies.

There exists a dragon for which all fairies ride it. This is a false statement in our world, because this requires the existence of a dragon.

However:
For all natural numbers x there exists a natural number y != x such that x < y is false. As above, choose x=0 and you have a counterexample.

There is a natural number x, such that for all natural numbers y != x, x < y is true. The natural number for which this holds is x=0.

It's hard to describe this formally without referring to models, but presumably you can piece the rest together yourself? If not I'll give the proof using models this evening. Now I'm going skiing
Hanh
Profile Joined June 2016
146 Posts
Last Edited: 2017-02-18 09:11:57
February 18 2017 09:11 GMT
#16922
Look at the variables.


there exists x, such that for all y

and

for all y, there exists x


They are flipped in the second statement.

For any predicate P(x, y) for which,

If [there is a x for which for all y, P(x, y) is true] then [for all y, there is a x for which P(x, y) is true].

In the first case x cannot depend on y. In the second case it can.




Prillan
Profile Joined August 2011
Sweden350 Posts
February 18 2017 09:27 GMT
#16923
On February 18 2017 18:11 Hanh wrote:
Look at the variables.

Show nested quote +

there exists x, such that for all y

and

for all y, there exists x


They are flipped in the second statement.

For any predicate P(x, y) for which,

If [there is a x for which for all y, P(x, y) is true] then [for all y, there is a x for which P(x, y) is true].

In the first case x cannot depend on y. In the second case it can.


Just wanted to say that this is correct.

(a) exists x. forall y. P(x, y) => (b) forall y. exists x. P(x, y)

Thus, (a) is stronger than (b). It seems Acrofales didn't notice the flipped order of the variables in the quantifications.
TheBB's sidekick, aligulac.com | "Reality is frequently inaccurate." - Douglas Adams
Askelad
Profile Joined October 2016
France20 Posts
Last Edited: 2017-02-18 17:59:15
February 18 2017 11:45 GMT
#16924
.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2017-02-18 15:46:28
February 18 2017 15:24 GMT
#16925
On February 18 2017 14:29 dsyxelic wrote:
Show nested quote +
On February 18 2017 10:49 Blitzkrieg0 wrote:
Which node are you actually deleting is probably where you're running into issues.

When you delete the final node in the list your pointer is at position p. p.next is the final node in the list and it's p.next.next value is null. When you set the node at position p's next value to null you're removing the last node in the list as expected and not causing a problem.

HEAD -> [1] -> [2] -> [3] -> [4] -> [5] -> [6] -> [7] -> null


So if I need to delete 7, I want to traverse the list until p.next == 7. p will be at 6. Then I set p.next equal to p.next.next. The resulting list:

HEAD -> [1] -> [2] -> [3] -> [4] -> [5] -> [6] -> null



Consider the difference between delete(value) and delete(pointer). In the latter you've already done the search which is causing the discrepancy. The delete(value) function runs in O(n) time because you must traverse the list to find the node. However, the function signature looks like you're telling it to delete a pointer after you've traversed the list making it a O(1) deletion time. There is no search in the pseudo code.

Same example, but with delete(pointer):
function delete(6)
p=position
p.next = p.next.next


p.next.next is null. Set p.next equal to null and node 7 is removed in constant time.


Hi, thanks for this.
So I guess my confusion comes from my 'end' function not really being the true end of the list.

For example on my list x: 1 -> 2 -> 3 -> 4



I think it makes more sense to have everything based on the idea that you're returning p, but the value p.next is the actual result you're looking for. As long as all your function calls follow this pattern then the data structure makes sense. However, if you like the way you've set it up then it isn't wrong either. This is where documentation becomes important.

Does your list x look like:

A:
 HEAD -> [1] -> [2] -> [3] -> [4] -> null 

B:
 [1] -> [2] -> [3] -> [4] -> null 


Note in the A case that HEAD is a pointer to an empty node that does not contain any data. You'll still have an edge case at the front when you're making a new list, but you're only going to make the list once. You're always going to have these edge cases when you're implementing the data structure. It's more about implementing them in a way that causes the fewest amount of problems.

When the list is empty HEAD is null. When the list is created you create two nodes, the head node and add head.next as the first node. If you do end() on this you return HEAD and have head.next as the end of the list. If you then delete this pointer as per my previous post it will delete the correct node.

Alternately you can always have a list that is pointed to by HEAD. If HEAD.next is null then your list is empty and you need to insert as a special case.

When you're implementing data structures how the code actually works behind the scenes is irrelevant. You have certain methods exposed that are documented to do what they say they do. It is up to the user to utilize them properly.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Buckyman
Profile Joined May 2014
1364 Posts
Last Edited: 2017-02-18 17:18:28
February 18 2017 17:18 GMT
#16926
On February 18 2017 14:29 dsyxelic wrote:

seems fine? though I'm curious how python's default list is so much faster in every way possible


Most python implementations store their lists in a partly full array. Removing an element from the end is as quick as decreasing the 'size' variable, except that if you remove a lot of them it'll copy the remaining list into a smaller array.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-18 18:52:49
February 18 2017 18:50 GMT
#16927
Anyone want to tell me what they think of this C code? I feel like it's pretty well written. To the point. Normally I end up making these small exercises way more convoluted than they need to be. (inb4 i find out it's shit)

the specifications are to take the prototype and implement the function. the function takes the source string and copies it to the results string with leading and trailing whitespace removed. it then records how many spaces were removed into number_of_spaces. You return -1 if there was nothing to copy over.

code:

+ Show Spoiler +


int remove_spaces(const char *source, char *result, int *num_spaces_removed) {
int i = 0;
int j = strlen(source) - 1;
int k = 0;
int z = 0;

if(source == NULL || j == -1) {
return -1;
}


while(source[i]) {
if(source[i] == ' ') {
i++;
continue;
}
break;
}


while(1) {
if(source[j] == ' ') {
j--;
continue;
}
break;
}

for(k=i; k < (j+1); k++) {
printf("%d %d\n", k, j);
result[z] = source[k];
z++;
}

result[z] = '\0';

*num_spaces_removed = (strlen(source) - strlen(result));


return 0;
}


Biolunar
Profile Joined February 2012
Germany224 Posts
February 18 2017 19:12 GMT
#16928
On February 19 2017 03:50 travis wrote:
Anyone want to tell me what they think of this C code? I feel like it's pretty well written. To the point. Normally I end up making these small exercises way more convoluted than they need to be. (inb4 i find out it's shit)

the specifications are to take the prototype and implement the function. the function takes the source string and copies it to the results string with leading and trailing whitespace removed. it then records how many spaces were removed into number_of_spaces. You return -1 if there was nothing to copy over.

code:

+ Show Spoiler +


int remove_spaces(const char *source, char *result, int *num_spaces_removed) {
int i = 0;
int j = strlen(source) - 1;
int k = 0;
int z = 0;

if(source == NULL || j == -1) {
return -1;
}


while(source[i] {
if(source[i] == ' ') {
i++;
continue;
}
break;
}


while(1) {
if(source[j] == ' ') {
j--;
continue;
}
break;
}

for(k=i; k < (j+1); k++) {
printf("%d %d\n", k, j);
result[z] = source[k];
z++;
}

result[z] = '\0';

*num_spaces_removed = (strlen(source) - strlen(result));


return 0;
}


Whoever gave you that prototype is a C rookie.
int *num_spaces_removed
Really? That screams for buggy code on all major 64 bit platforms. Why is that you may ask:
int j = strlen(source) - 1;

if the source string has lenght 0 (i.e. source = ""),
strlen(source) - 1
will wrap around because strlen returns a size_t. So you are basicly asigning SIZE_MAX to j. Please set your compiler warnings higher! The compiler will complain about this line because you are truncating a size_t to an int. Remember: object sizes must be of type size_t!

Other than that I have no clue to what your function is trying to achive. The first two loops are completly unecessary. Just loop once and copy every character from source to dest and skip spaces. You need just two counting variables for both strings.
What is best? To crush the Zerg, see them driven before you, and hear the lamentations of the Protoss.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-18 19:22:27
February 18 2017 19:22 GMT
#16929
interesting about strlen(source) - 1

As for just looping and copying all non-spaces, that doesn't work because we are not skipping spaces that are inbetween non-space characters. We are only removing trailing and leading whitespace.
Biolunar
Profile Joined February 2012
Germany224 Posts
Last Edited: 2017-02-18 19:31:25
February 18 2017 19:30 GMT
#16930
On February 19 2017 04:22 travis wrote:
interesting about strlen(source) - 1

As for just looping and copying all non-spaces, that doesn't work because we are not skipping spaces that are inbetween non-space characters. We are only removing trailing and leading whitespace.

One loop is still enough. Skip the first spaces until you reach a non space character. Use an index (e.g. size_t end) to remember when you copied the last non space character. Once you are done copying, set source[end] to 0 to cut off the last spaces.
That is part of the reason why that prototype sucks. There is no parameter to specify how large the dest buffer is…
What is best? To crush the Zerg, see them driven before you, and hear the lamentations of the Protoss.
Acrofales
Profile Joined August 2010
Spain18114 Posts
February 18 2017 19:56 GMT
#16931
On February 18 2017 18:11 Hanh wrote:
Look at the variables.

Show nested quote +

there exists x, such that for all y

and

for all y, there exists x


They are flipped in the second statement.

For any predicate P(x, y) for which,

If [there is a x for which for all y, P(x, y) is true] then [for all y, there is a x for which P(x, y) is true].

In the first case x cannot depend on y. In the second case it can.






Okay, I see it now. So for starters, and this is more at travis than at you: quantified variables are quantified variables. For all I cared, you could use "cupcake" as your variable name. If the order of your variables are important, make it explicit.

But either way, the claim is still wrong. For the sake of simplicity, I have written it out here:

(1) \exists x \forall y P(x, y)
is stronger than
(2) \forall x \exists y P(y, x)

This is also not true. All we need to do is find a P and a model m such that m \models (1), but m \not\models (2). Right.

Or if you prefer it in your form of implication (2) \rightarrow (1) is false if (1) is false while (2) ist true (which boils down to essentially the same thing, but is less formal.

Here's a simple counter example:

Let X = {a, b} and Y = {a}
R = {(a, a)}

Now:
\forall x \in X \exists y \in Y such that (y, x) \in R

This is false. Counter example: x=b

However:
\exists x \in X \forall y \in Y such that (x, y) \in R
This is true, because it is true for x=a.

Therefore, unless you also make some requirements of the domains of your variables and probably some properties of P, this is definitely not true.

There is an interesting relationship between the two statements. I'm not sure whether your lemma might be true if we restrict x and y to be from the same set. I didn't immediately see a counterexample (but also haven't looked very hard, or tried to construct a proof).

But the sweeping statement you made is still false even when you clarify the switched variables.

+ Show Spoiler +
Thankfully. Would be rather embarrassing for me to be wrong on something like this
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 18 2017 19:57 GMT
#16932
On February 19 2017 04:30 Biolunar wrote:
Show nested quote +
On February 19 2017 04:22 travis wrote:
interesting about strlen(source) - 1

As for just looping and copying all non-spaces, that doesn't work because we are not skipping spaces that are inbetween non-space characters. We are only removing trailing and leading whitespace.

One loop is still enough. Skip the first spaces until you reach a non space character. Use an index (e.g. size_t end) to remember when you copied the last non space character. Once you are done copying, set source[end] to 0 to cut off the last spaces.
That is part of the reason why that prototype sucks. There is no parameter to specify how large the dest buffer is…


I actually thought about this way. I thought mine was better(easier, at least). Maybe it's not.
dsyxelic
Profile Joined May 2010
United States1417 Posts
February 18 2017 20:04 GMT
#16933
On February 19 2017 00:24 Blitzkrieg0 wrote:
Show nested quote +
On February 18 2017 14:29 dsyxelic wrote:
On February 18 2017 10:49 Blitzkrieg0 wrote:
Which node are you actually deleting is probably where you're running into issues.

When you delete the final node in the list your pointer is at position p. p.next is the final node in the list and it's p.next.next value is null. When you set the node at position p's next value to null you're removing the last node in the list as expected and not causing a problem.

HEAD -> [1] -> [2] -> [3] -> [4] -> [5] -> [6] -> [7] -> null


So if I need to delete 7, I want to traverse the list until p.next == 7. p will be at 6. Then I set p.next equal to p.next.next. The resulting list:

HEAD -> [1] -> [2] -> [3] -> [4] -> [5] -> [6] -> null



Consider the difference between delete(value) and delete(pointer). In the latter you've already done the search which is causing the discrepancy. The delete(value) function runs in O(n) time because you must traverse the list to find the node. However, the function signature looks like you're telling it to delete a pointer after you've traversed the list making it a O(1) deletion time. There is no search in the pseudo code.

Same example, but with delete(pointer):
function delete(6)
p=position
p.next = p.next.next


p.next.next is null. Set p.next equal to null and node 7 is removed in constant time.


Hi, thanks for this.
So I guess my confusion comes from my 'end' function not really being the true end of the list.

For example on my list x: 1 -> 2 -> 3 -> 4



I think it makes more sense to have everything based on the idea that you're returning p, but the value p.next is the actual result you're looking for. As long as all your function calls follow this pattern then the data structure makes sense. However, if you like the way you've set it up then it isn't wrong either. This is where documentation becomes important.

Does your list x look like:

A:
 HEAD -> [1] -> [2] -> [3] -> [4] -> null 

B:
 [1] -> [2] -> [3] -> [4] -> null 


Note in the A case that HEAD is a pointer to an empty node that does not contain any data. You'll still have an edge case at the front when you're making a new list, but you're only going to make the list once. You're always going to have these edge cases when you're implementing the data structure. It's more about implementing them in a way that causes the fewest amount of problems.

When the list is empty HEAD is null. When the list is created you create two nodes, the head node and add head.next as the first node. If you do end() on this you return HEAD and have head.next as the end of the list. If you then delete this pointer as per my previous post it will delete the correct node.

Alternately you can always have a list that is pointed to by HEAD. If HEAD.next is null then your list is empty and you need to insert as a special case.

When you're implementing data structures how the code actually works behind the scenes is irrelevant. You have certain methods exposed that are documented to do what they say they do. It is up to the user to utilize them properly.


Mine looks like B.

I did not know that (bolded part), that's definitely good to know. I implemented in a way that p gives the actual result besides end(). I guess ideally I would have everything consistent but again, the book we're using did it with p giving the actual result and apparently didn't account for deletion from the back.

Thanks though you were a lot of help.
TL/SKT
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-02-18 20:12:23
February 18 2017 20:11 GMT
#16934
sometimes I read stuff in this thread and I am amazed at just how smart you guys are. how much varied stuff you guys know and how precise you are at it. and I wonder to myself "how are these guys not able to work anywhere they want on the cutting edge with this much ability". but then again, maybe you are?

But anyways I read it and am just constantly reminded of how much effort I will have to put in to actually be exceptional in this field, when this is how high the bar is set.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2017-02-18 20:31:09
February 18 2017 20:28 GMT
#16935
On February 19 2017 05:11 travis wrote:
sometimes I read stuff in this thread and I am amazed at just how smart you guys are. how much varied stuff you guys know and how precise you are at it. and I wonder to myself "how are these guys not able to work anywhere they want on the cutting edge with this much ability". but then again, maybe you are?

But anyways I read it and am just constantly reminded of how much effort I will have to put in to actually be exceptional in this field, when this is how high the bar is set.

You see a dozen or more people showing off their knowledge in their respective fields of expertise. You especially don't see people answering with an unhelpful and slightly embarassing "I don't know". You don't need to be exceptionally smart to be good at a couple of things. With actual job experience you also learn a couple of things in detail, often the hard way. That kind of stuff tends to burn itself into your mind.

But yes, this software as a job is not something where you learn stuff once and then stop putting in effort.
If you have a good reason to disagree with the above, please tell me. Thank you.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2017-02-18 20:30:53
February 18 2017 20:30 GMT
#16936
Gee why do I keep using quote instead of edit...
If you have a good reason to disagree with the above, please tell me. Thank you.
slmw
Profile Blog Joined October 2010
Finland233 Posts
February 18 2017 20:38 GMT
#16937
On February 19 2017 04:57 travis wrote:
Show nested quote +
On February 19 2017 04:30 Biolunar wrote:
On February 19 2017 04:22 travis wrote:
interesting about strlen(source) - 1

As for just looping and copying all non-spaces, that doesn't work because we are not skipping spaces that are inbetween non-space characters. We are only removing trailing and leading whitespace.

One loop is still enough. Skip the first spaces until you reach a non space character. Use an index (e.g. size_t end) to remember when you copied the last non space character. Once you are done copying, set source[end] to 0 to cut off the last spaces.
That is part of the reason why that prototype sucks. There is no parameter to specify how large the dest buffer is…


I actually thought about this way. I thought mine was better(easier, at least). Maybe it's not.


I think with C you need to put a lot of effort into making your code as simple as possible, since the language offers very little help. Fewer moving parts should make the code a lot easier to read. Try to cut as many extra lines of code as long as it also makes the code somewhat more readable. A common pattern in string handling is to simply loop until str[i]==0, instead of using strlen to avoid extra passes. Another common trick is to use a[i++] = b[j++] for copying a string.

With a single pass the code becomes quite a bit shorter:

int i = 0, j = 0, end_pos = 0;
for(i=0;source[i]!=0;i++) {
bool space = source[i]==' ';
if(j || !space ) {
if(!space) end_pos = j+1;
result[j++] = source[i];
}
}
result[end_pos] = 0;
*num_spaces_removed = i-end_pos;
return (i-end_pos) == 0 ? -1 : 0;


You can do two passes in a similar manner:
int j = 0, last_char = -1, len = 0;
for(len=0;source[len]!=0;len++) if(source[len]!=' ') last_char = len;
for(int i=0;i<=last_char;i++) {
if(j || source[i] != ' ') {
result[j++] = source[i];
}
}
result[j] = 0;
*num_spaces_removed = len-j;
return (len-j) == 0 ? -1 : 0;


A lot of this is of course subjective, verbose code might be easier to read for some people. At least after doing a lot of string processing in pure C this style should become easier to read.


Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 18 2017 20:52 GMT
#16938
slmw could you explain


bool space = source[i]==' ';


is "bool" in a certain library in C? I was under the impression C doesn't have a boolean type.

What is the syntax here?

bool name = [ statement ] ?
it's syntax is weird to me
Acrofales
Profile Joined August 2010
Spain18114 Posts
February 18 2017 21:04 GMT
#16939
C99 has bools.

as for the use, it's

bool name = <something boolean>

could be

bool stopyet = false;
<do stuff>
stopyet = true;
if (stopyet) {
exit(0);
}


or as slmw wrote, some statement that evaluates to true/false. I would put it between brackets,though. I hate depending on non-obvious precedence between operators for my code to work. Does C parser parse that as:

(bool space = source[i]) == ' '; //gibberish
or
bool space = (source[i] == ' '); //what you want: assigns the outcome of the comparison to your newly declared bool.

If assignment were to have a higher precedence than comparison, C parser would give you the former, which at best wouldn't compile (haven't tested). But that's just personal preference for the style, perhaps if I was more familiar with C, I wouldn't be bothered by it.
tofucake
Profile Blog Joined October 2009
Hyrule19151 Posts
February 18 2017 21:52 GMT
#16940
On February 19 2017 05:30 spinesheath wrote:
Gee why do I keep using quote instead of edit...

It gets even more annoying when you can edit any post...
Liquipediaasante sana squash banana
Prev 1 845 846 847 848 849 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
09:00
WardiTV Mondays #59
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 286
StarCraft: Brood War
Britney 49000
Rain 2987
Hyuk 2893
Soma 360
Backho 327
Rush 213
Pusan 117
JulyZerg 53
sSak 31
zelot 14
[ Show more ]
NaDa 12
Noble 11
ZerO 10
Hm[arnc] 8
Terrorterran 7
Dota 2
XaKoH 419
XcaliburYe139
Counter-Strike
fl0m1798
olofmeister680
shoxiejesuss411
oskar63
Super Smash Bros
Mew2King237
Other Games
ceh9502
Happy244
Pyrionflax116
ZerO(Twitch)4
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH257
• LUISG 21
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1347
• Stunt515
Upcoming Events
OSC
1h 54m
Kung Fu Cup
2h 24m
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
13h 24m
The PondCast
1d
RSL Revival
1d
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
1d 2h
WardiTV Korean Royale
1d 2h
PiGosaur Monday
1d 15h
RSL Revival
2 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
2 days
[ Show More ]
CranKy Ducklings
3 days
RSL Revival
3 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
3 days
IPSL
3 days
ZZZero vs rasowy
Napoleon vs KameZerg
BSL 21
3 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
4 days
RSL Revival
4 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
4 days
WardiTV Korean Royale
4 days
BSL 21
4 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
4 days
Dewalt vs WolFix
eOnzErG vs Bonyth
Wardi Open
5 days
Monday Night Weeklies
5 days
WardiTV Korean Royale
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.