« first day (433 days earlier)      last day (3576 days later) » 

12:01 AM
Okay, I believe I have a working FizzBuzz now. I'll post it soon.
 
12:12 AM
@Jamal next, RPSLS? ;)
 
Maybe. :-)
0
Q: FizzBuzz implementation using the ternary operator JAVA

JamalThis is my first time writing JAVA, and I'm trying to start off on the right track. Using my C++ knowledge, I was able to understand the syntax for the ternary operator, but I'm not sure how it should be approached properly in JAVA. I have used Ideone to test this, which include importss that a...

(yes, I wasn't bluffing when I said I would put "JAVA" in the title :-P)
gulps
 
I already edited it :P
 
What about the post body? ;P
 
you missed two JAVAs
 
they can stay
 
12:20 AM
lol
 
Fair enough. I'm only going to do it with this post.
 
1
Q: FizzBuzz implementation using the ternary operator

JamalThis is my first time writing JAVA, and I'm trying to start off on the right track. Using my C++ knowledge, I was able to understand the syntax for the ternary operator, but I'm not sure how it should be approached properly in JAVA. I have used Ideone to test this, which include importss that a...

 
Yes, thank you.
 
maybe it's just me but i think those ternaries make more sense like:
(i % 15 == 0) ? "FizzBuzz" :
(i % 3 == 0) ? "Fizz" :
(i % 5 == 0) ? "Buzz" :
i
that's how i usually do it anyway
 
I wasn't sure how to structure it with println(). Heck, I didn't even know you could cram the whole thing into it, although I do remember that Java requires the ternary to be non-void.
 
12:27 AM
it's the same as you wrote, just with line breaks in different places so the condition is together with the case
didn't you already get yelled at for importing too much stuff and not making that class public?
 
I must've missed it, but perhaps that part can be reviewed so that I know exactly why.
 
true, would be nice to know if it can optimize out imports it doesn't need
i assume the class needs to be public so you can call main from the shell (or wherever) to launch the program, but idk
 
Now I kinda feel guilty for starting out on Ideone. Rest assured, my next code for review will be done locally.
 
iirc when you run a Java program you need to pass the name of the class with main, i guess it needs to be public
 
Anyway, I can fix the alignment as you've suggested, unless you want to post that instead.
 
12:35 AM
nope i'll let the experts handle the reviews :)
 
I'll adjust it, then. If someone happened to be addressing those same things, then I'll roll back.
 
hmm, 3 questions tagged [fizzbuzz] and [unit-testing]
 
wow, this one is like, way overboard!
59
A: How effective is speeding?

alemiAlright, let's start with your direct question. Since $d = vt$ the time it takes to travel a certain distance is inversely proportional to your speed $ t \propto v^{-1} $, and so the fractional change in time is proportional to the negative fractional change in your speed. $$ \frac{dt}{t} = - \...

thanks @Santa!
..just got 2 upvotes on an answer that suggested a private static method... to do return new Enumerator(this); - what was I thinking, this in a static method?!
 
12:53 AM
@Mat'sMug I'm tempted to write a traffic simulator to test it under different scenarios...
 
Got a review from Greg (and he's almost to 1K).
 
nice!
 
> While this is certainly valid code, this many nested ternaries generally make code harder to read and debug.
 
Ugh, it's gonna take some getting used to treating everything as classes and separate objects.
 
^ i don't get why people keep saying things like that
 
12:58 AM
Oops
 
lol
 
@Jamal's learning JAVA!
 
@ckuhn203 Shouldn't that be JAMAL?
 
And @Mat'sMug was smoking the documentation I guess...
 
yeah...
 
1:00 AM
I may just get my next exercise from a book or somewhere online (or I can just get an idea from JD).
 
if it's true that "in a conditional expression a ? b : c, the types of b and c must match (or be subclasses of each other)" then how does foo ? "Buzz" : i even work when i is a number?
 
@ckuhn203 I do enjoy the new job :) ...I miss The 2nd Monitor though
 
You have lots of JD questions to choose from.
That's great man. I'm happy for you.
 
@DaggNabbit I presume println implicitly calls .toString on the integer. Console.WriteLine does that in C#
 
:-)
snuggles std::cout tightly
 
1:02 AM
@Mat'sMug but that statement was only regarding conditional expressions themselves, not println
 
@Mat'sMug From memory, you're right, it does
 
0
Q: Factory style pattern in method

Cameron BallI have a method in a class, and its sole purpose is to prepare another class for use: private function createHttpPost($endPoint) { $httpPost = new HttpPost($this->baseUri . '/' . $endPoint); $httpPost->setContentType('application/json'); $httpPost->setAccept('application/json'); ...

 
Couple of terminology things: (1) The language name is Java (upper/lower case). (2) The ?: operator is the conditional operator; a "ternary operator" is any operator that takes three operands (there is only one ternary operator in most programming languages, so people often say "ternary operator" when they mean "conditional operator"). — Greg Hewgill 34 secs ago
 
@DaggNabbit I don't think it would work in another context than println (assuming the implicit toString), like, if you assigned the ternary to a String I assume JAVA would blow up.
 
Hm... should I have hid the meme link in here somewhere?
 
1:03 AM
#define println(x) std::cout << x << '\n';
 
:O
 
I actually saw that in some C++ code the other day...
 
@Edward Bad macro. Bad!
2
 
@Mat'sMug so i guess it's not that the conditional expression can't handle different types, it's more about what you do with the result of that expression
i'm probably reading things too literally as usual
 
@GregHewgill it's a "CR thing" (see this meta post).. JAVA was intentional ;) — Mat's Mug 2 mins ago
 
1:06 AM
are there other ternary operators in Java?
 
@DaggNabbit It's actually odd, it seems to do the cast before calculating the resultant type
 
Lol. It's not JAVA, it's Java. Bahahahaha
 
@DaggNabbit Yes, but only one of the options is ever taken. :)
 
String x = true ? "Foo" : 1;
that won't compile
System.out.println(true ? "Foo" : 1);
that will
 
@Yuushi that's interesting
i assume true is a proper keyword and there's no possible way to redefine it
 
1:08 AM
oh my.. has Greg showed up in the 2nd monitor yet?
@Mat'sMug: I'm afraid I don't understand. On what basis are Java and JAVA treated as two different languages? As far as I can tell they follow the same rules as set out in the Java Language Specification. — Greg Hewgill 54 secs ago
 
@DaggNabbit Yeah
 
@Yuushi I found about that from an SO answer, and I was surprised.
 
now we need a backronym for JAVA
 
I'm guessing it does a rewrite to System.out.println(true ? "Foo".toString() : 1.toString());
well, the equivalent of that, since 1 doesn't have methods
 
0
Q: Need feedback on CUDA - my 1st cuda code

Ungluedso I'm learning CUDA and wrote a little program which generates prime numbers using the Sieve of Eratosthenes. (I know the limitations of CUDA, specially with memory sizes and limits, but this program is for educational purposes). So my questions are: Did I set up the configuration correctly? ...

 
1:09 AM
at least I can say I've learnt something today
even though I'll probably have forgotten it by the end of the day
 
if there are no other ternary operators in Java, idk why people can't say "the ternary operator" and mean it
 
That's why I try to learn a couple of things every day, just to keep pace with forgetting...
6
 
@GregHewgill: It's nothing more than an attempt at poking fun at those (mainly on SO) who call it JAVA instead of Java. I've seen many of these instances, and it sort of stuck to me. — Jamal ♦ 11 secs ago
 
^ +1
 
@CaptainObvious Is anyone (else) going to edit this?
 
1:12 AM
he's technically correct (the best kind of correct) in saying that it shouldn't really be known as "the ternary operator"
 
hey @mjolka!
 
@Jamal I tried changing your name to JAMAL but it didn't work.
3
 
but given it's about the only ternary operator in most languages that support it, eh
 
Hm... looks like I should be extra-careful about using ?: in Java from now on.
 
Here's a whole page of ?: goodness: en.wikipedia.org/wiki/%3F:#Java
 
1:15 AM
hullo @Mat'sMug :)
 
?: makes me miss languages where everything is an expression, so you don't need silly operators
 
@mjolka I'm sorry I couldn't dive deeper into your code, I hope my answer isn't too disappointing!
 
@Mat'sMug that's ok, it's a lot of code after all
 
yeah, but the 100pts bounty accounts for that ;)
 
i don't really get the last point in your answer
 
1:17 AM
@Yuushi I still have a strange attraction to Forth, where : ? @ . ; is actually coherent and useful code.
 
yeah that ~60 views it had was a bit disappointing. hopefully the bounty helps it out
 
@mjolka you're calling enumerator.MoveNext() just to return if that returns false, then you're validating that the Current element isn't null.
 
@Edward that's veering into APL territory
 
So, println() has separate overloads for each native type?
 
...but then you're re-doing that for all other elements, in the loop that follows.
and having already called MoveNext() your count starts at 1
 
1:19 AM
@Yuushi Yeah, and I have actually programmed in APL as well... Please help find a cure.
 
@Mat'sMug yep, it's so that i can set this.initialState to a FinalState if the first string is the empty string
 
@Edward Where's that Dijkstra quote about BASIC when you need it...
 
@Yuushi Here it is complete with context.
 
@Mat'sMug i could move setting this.initialState inside the loop, but that seems wasteful as it only depends on the first string in the collection
 
@mjolka that causes some code duplication that ought to be either refactored, or outright eliminated. I'm sure there's a way to make that check inside the loop, and start the count at 0. Basically I don't like that the first item is a special case.
 
1:23 AM
@Edward "Programming is one of the most difficult branches of applied mathematics; the poorer mathematicians had better remain pure mathematicians." <- I haven't heard that one before
 
@Mat'sMug i don't like it either :)
 
that's what the last point is all about :)
 
@Yuushi I had to include the whole thing because of the APL quote.
 
haha, indeed
 
An ICollection<String> that throws a NotSupportedException on Add and Remove doesn't sound right though
 
1:25 AM
@Mat'sMug it's ugly, i agree. but they did provide an IsReadOnly property on the interface
 
hmm
 
i was thinking an explicit interface implementation would be the way to go for Add, Clear, Remove
 
not a bad idea
 
i also considered ReadOnlyCollection<T>, but then you have to provide an Item indexer, which i can't
 
seems like a lot of trouble for checking valid words in a scrabble-like game. isn't there a simpler way?
 
1:29 AM
sure, HashSet<string> :)
 
TBH I'm a little lost with the state thing, that part left me totally swooshed!
 
which state thing?
 
and edges
/// Adds an edge out of the state.
 
hm. "transition" is probably a better word than edge
though wikipedia uses both terms
 
this is where not completing CS bites me
 
1:35 AM
which bit is unclear?
 
gotta go annoy a compiler. see y'all
 
later @Edward!
 
Later!
 
@mjolka lol, I'd need a whole course on acyclic finite-state automata I guess ;)
just the name of it scares the shit out of me!
that's why my answer isn't very fleshed out :(
 
:) nothing scary about them (besides the name). just think of a graph with labelled edges
some states are final, others are not
(maybe tree instead of graph)
start at the root, follow the labels on the edges matching the characters in your string
if you end up at a final state, your string is in the collection
 
1:40 AM
"final state" being the last character of a word?
 
bingo
 
oh damn
 
This is one of the best answers I've found on CR.
5
A: OOP-style FizzBuzz program in PHP

ChrisWueFirst of: I like the iterator approach. We use the FizzBuzz problem as part of our interview process and to this date nobody went down that route. The main points I have: Apparently your solution is quite over-engineered for a problem like this so I just assume you did it for the lack of a pro...

 
@ckuhn203 OP starts with interface FizzBuzzable. (runs)
 
the tricky bit (which is taken from the linked paper) is sharing parts of the tree
 
1:41 AM
like "FizzBuzz" and "FizzBuzzable"
 
exactly
 
No no. Not the OP. The answer @Mat'sMug.
 
lol I know, it's just.. the OP is really over-the-top over-engineered!
class FizzBuzzFactory
 
@Mat'sMug your comment worked in both conversations simultaneously :/
s/worked/made sense/
 
hehe
BTW did you know you can edit your recent chat posts with [arrow-up]?
 
1:44 AM
now i do :)
 
Point 4 was awesome. I'm off to read more fizzbuzz questions.
 
omg...
 
There are Objective-C libraries available for using a Wiimote...
 
@mjolka oh, gosh I'm slow today.. I meant the over-engineered for the fizzbuzz PHP code!
now that I have a better understanding of what the code is actually doing (and why), I'll see if I can spare an evening in the next 7 days to flesh up my answer!
I'm bounty-hunting :)
 
1:48 AM
@Mat'sMug yeah i got that :) I meant your comment "like "FizzBuzz" and "FizzBuzzable"", as those two strings would share parts of the FSA in the string-collection
@Mat'sMug awesome! i look forward to seeing it. off for a smoke
 
(got some @Simon's to kick off an imaginary wall that used to be full of mugs, now filled with a thousand Simons)
@mjolka heck, me too! :)
 
Well, the nice thing about posting Java code is that there are (or seems to be) more Java reviewers around than C++ reviewers. I'm sure monkey and Simon will really tear this little code apart. D:
 
i.stack.imgur.com/FV9AF.png nevermind this...
Just wanted a stack.imgur
 
Just 11 more first-post reviews on SO, and I'll have Reviewer.
 
Nice!^
 
1:56 AM
But still about 200 more edits until Copy Editor...
 
So... sometime next month? =;)-
 
Probably not. I'm not being that observant of posts to edit; I just find them as I look through a list of other posts to flag.
 
2:15 AM
Really small nit-pick: "...an overload that takes an Object parameter (and then calls the toString() method to get a string representation of the object)." This is not strictly accurate. It does not call the object.toString() method. It actually does String.valueOf(object), which has slightly different handling of null object values... — rolfl ♦ 1 min ago
Monkey's around!
 
in C# it's ToString() that gets called implicitly
 
0
Q: iOS 7 is it still necessary to check for a front camera?

troop231I'm trying to clean up redundant old code, so I'm asking this general question. Since all iOS 7 devices have a front camera, would it be safe to remove the code to check if the device has a front camera? In the past this was necessary as not all devices with iOS 6 had a front camera. It is true ...

 
Hmmm /// did CR just go down?
> It's not just you! codereview.stackexchange.com looks down from here.
 
2:35 AM
@hichris123!
 
@Jamal what? Do you not like me? ;P
 
But I said hi! ;-)
 
Hi!
 
2:49 AM
0
Q: Add a set of querystring params to a url

Don BootsExample cases: Need to add x=1, y=2 querystring variables to the following urls: http://www.foo.com/blah/blah?test=1&abc=2 http://www.foo.com/blah //-- usage get_link(array('x' => 1, 'y' => 2, 'z' => 'string')); function get_link( $my_params ) { $param_querystring = ""; $http_host ...

 
@CaptainObvious is he looking a code review or a fortune teller
 
It might be leaning towards off-topic.
 
i wonder if it's possible to put iOS7 on a jailbroken device that shipped with iOS6
probably so
but yeah it doesn't look like he wants a code review to me
VTC'd as opinion-based
 
3:04 AM
is there an acceptable way to answer along the lines of, "your code has already been reviewed but since you asked about performance, here's a fast way of doing it"?
"(ps your code doesn't work)"
 
3:40 AM
YAY power AND internet are on :D
Also, obligatory Hello, World!
Oh and I earned "Mortarboard" today
5
 
And I posted my first Java question. :D
 
Do show! As long as it's not JAVA
 
Um...
5
Q: FizzBuzz implementation using the ternary operator

JamalThis is my first time writing JAVA, and I'm trying to start off on the right track. Using my C++ knowledge, I was able to understand the syntax for the ternary operator, but I'm not sure how it should be approached properly in JAVA. I have used Ideone to test this, which include importss that a...

 
Oh. lol
 
It's sort of my "sneak peek" into writing Java. My next question will be a somewhat larger program, using a local compiler (as opposed to Ideone).
And after I become more confident with Java, I'll start following .
 
3:51 AM
The Time Warner setup, while I had to speak to 5 different people, was surprisingly painless. All 5 were kind, knowledgeable, and I managed to reduce my bill on top of getting internet working.
 
4:01 AM
We have completed the #redis 2.8.12 upgrade and are addressing the issues that caused #stackoverflow to be offline for a few minutes.
 
4:13 AM
So in Java, int and Integer are not the same... what?
> I think we should migrate this to dba.stackexchange.com – Phrancis just now
2
Q: Am I getting the right information about installed SQL Server Instances?

Jerry DodgeI'm building an installer package for our software using Inno Setup. As a part of this, I'm also building a few different DLL's in Delphi XE2 to accommodate for some of the common tasks required by the installer. One of those is querying and manipulating settings on these instances. I intend to s...

 
@Phrancis I see it as being a good thing.
TTGTB
 
0
A: Printing simple SQL comparsion

PhrancisFor the tiny amount of code there is to review, here goes. CREATE PROCEDURE IF NOT EXISTS sp_FullExVat @aTotalExVat, @sTotalExVat BEGIN PRINT '==Full Ex Vat==' PRINT CASE WHEN @aTotalExVat = @sTotalExVat THEN 'true' ELSE 'false' END CASE; END; Then just CALL sp_FullExtVat...

I hate SQL Server syntax. Seems very clumsy.
Why are PROCEDURE parameters preceded by @ but local variables also preceded by @? Who knows.
They are vastly different things, yet MS make you label them the same
Same for #tempTable and #tempProcedure and who knows what else... #tempView? #temp@Variable?
</rant>
 
4:34 AM
0
Q: Basic Calculator using Java Swing and AWT

BroomesI created a basic desktop calculator using Java. Does anyone have any suggestions as far as coding best practices, readability issues, or just generic coding mistakes I might have missed? Any professional input you could provide would be greatly appreciated. Calculator.java package calc; import...

0
Q: Followup: How do I optimize this Java cube root function for BigInteger?

Brian J. FinkFollowup to Cube Root Algorithm So I've tried several implementations of this algorithm. The version using only BigInteger sometimes results in a never-ending cycle of candidates: public static final BigInteger _3=BigInteger.valueOf(3); public static BigInteger cbrt(BigInteger num) { BigInteg...

 
4:52 AM
morning all
 
Hey @chillworld
 
Good morning.
 
Alright, I'm going to kill this zombie
 
0
Q: How to Optimize this android code?

Dedaniya hirenkumarI am Developing Custom Grid View with different columns. Here is the full demo. You can directly use them, with Internet uses permission MainActivity.java package com.example.rtrt; import java.util.ArrayList; import com.squareup.picasso.Picasso; import android.os.Bundle; import android.app...

 
5:09 AM
I'm writing a question :)
 
Is it just me or is crazy?
 
@Phrancis what do you mean by "crazy"?
 
It's sort of like SQL, but turned inside out and upside down...
(or maybe he just sucks at it)
 
and here it is mine question :
0
Q: Java enum for mapping classes and specific url

chillworldI have a ZK project in Java 6. ZK is like asp.net but with zul files in stead of aspx. For showing and creating/updating the catalogs I created an abstracted view. This all works with 1 viewmodel at the back. To go to the right catalog I provide a String what is the repo class his name. Of cours...

 
Oh frack me, this linq/sql script is a mess... WHO writes code like this for a living???
 
5:24 AM
one sec, taking a look
It looks weird but that could be cause I don't know linq :s
 
Oh, Micro$oft made LINQ no wonder it looks messy. msdn.microsoft.com/en-us/library/bb397926.aspx
Oh it's VB... with a bit of C#.. and a bit of SQL...
 
0
Q: Java enum for mapping classes and specific url

chillworldI have a ZK project in Java 6. ZK is like asp.net but with zul files in stead of aspx. For showing and creating/updating the catalogs I created an abstracted view. This all works with 1 viewmodel at the back. To go to the right catalog I provide a String what is the repo class his name. Of cours...

 
Oh and some XML and some ADO.NET (whatever that is). Sounds like a fantastic idea.
 
"sounds" yeah ;)
 
I'm gonna start my answer with this:
##**Start over.**##
 
5:50 AM
:D
 
@Phrancis are you sure you don't mean # ##Start Over## ?
 
@Vogel612 something like that. LINQ is ugly.
 
@Phrancis it can be beautiful... but he abuses it, and thus loses performance and readability..
 
I'll believe it when I see it. But yeah, his code is ugly for sure.
 
brb trying to get coffee
 
6:06 AM
try {
    get(COFFEE);
} catch (NoCoffeeMachineException e) {
    logger.log(LogLevel.FATAL, e.getMessage());
} catch (NoCoffeeBeansException ex) {
    refillCoffeeBeans();
    tryToGetSomeCoffee();
} catch (NoWaterException ex) {
    refillWater();
    tryToGetSomeCoffee();
}
 
6:38 AM
Alright TTGTB
 
7:11 AM
0
Q: JQuery Plugin Zoom in Zoom out

user3534656I careated my first plugin in jQuery, jsut want some inputs to improve the cod and features. Here is the fiddle Thanks

 
@CaptainObvious Off-topic, as missing code in question
 
7:40 AM
Fun, intellisense throwing NRE's
 
R?
 
7:59 AM
reference
 
ohhhhh...
 
0
Q: Programming for future use of interfaces

sveriI have a colleague sitting next to me who designed an interface like this: public interface IEventGetter { public List<FooType> getFooList(String fooName, Date start, Date end) throws Exception; .... } The problem is, right now, we are not using this "end" parameter anywhere ...

 
8:17 AM
@CaptainObvious off-topic, pseudocode, not asking for a review. probably better off on The Workplace or Programmers
 
8:31 AM
geezes
all these exceptions about disposed sqlite connections are because my tests finish before the asynchronous calls finish
Should've brought this up on the standup way earlier
took them 5 seconds to go "why don't you use Thread.Sleep?
To be fair though: I didn't make the link between the end of test and the disposed connection
but still
 
8:47 AM
@Vogel612 is the there is a coffeemachine in the bar but bar is closed also included in the exception of NoCoffeeMachineException?
 
@chillworld there is no bar.
afterm all this is school
either way, lesson is over, coming back later ;)
 
Monking
That was yesterday evening...
It's forecast/measurement of amount of rain that fell
 
9:13 AM
@chillworld I don't think what you are doing is correct, as you cannot rename a class without causing havoc. (It's one of my tests for correctness)
I have some alternative ideas, will share once I have time
 
@skiwi always welcome alternative idea's. that's why I ask it also cause I know the Mapper is very important atm (and a broken one can react bad)
 
If you currently test all pages after you do an update, then I don't think any bad will happen, worst would be compile errors cq errors that are always present on a certain page
 
@SimonAndréForsberg it sounds like you're saying there is no pre-increment operator in Java / C#...
++i / i++ never matters in the last part of a for loop but it matters everywhere else
and afaik it's the same for all c-style languages
it doesn't matter if you pre- or post-increment in a for loop iterator because it always happens after the previous loop and before the next one
oh he's not here :p
 
9:35 AM
for the moment it's all good, I hope it stay's that way ;)
 
speak of the devil
 
@DaggNabbit Not everywhere else, but I get your point. I will edit.
@DaggNabbit That better?
@DaggNabbit I'm no devil!
 
> In C++ and C, if you're using ++i or i++ in a for loop has different performance.
is that true?
i would assume it works exaclty the same
 
Woohoo, data can be stored in the database!
 
@rolfl I missed it by two once, I know the feeling!
 
9:40 AM
Victory over the evil that is called WinRT
 
@DaggNabbit I think it has a different assembly by default... however smart compilers should be able to figure out when ++i and i++ mean the same and hence use the most performant version
 
@DaggNabbit See the link. As far as I can tell, it seems true.
 
0
Q: Hints to make Sukoku solver more Pythonic (II)

magu_I tried to implement as many changes suggested as possible as well as expanding the code base according to the suggested link. The original question can be found here: (Hints to make Sudoku solver more Pythonic). It does solve Sudokus gives outputs for 4x4 and 9x9 Sodukus. My question is what sho...

 
++i means increment i and then do the rest of the statement. i++ is do the statement and then increment i. If there is no rest of the statement, it should be identical. I'll test it later maybe
 
Maybe it only matters when it's inside other code
@chillworld Interesting enum here... SEX(Sex.class, SexRepository.class, QSex.sex._super)
 
9:56 AM
wth
 
@DaggNabbit From what I understand, not all C/C++ compilers are aware that there is no rest of the statement. Therefore, they're treating the code as if there were some "rest of the statement"
 
but why would you need two different ways to increment something, whether you're doing it before or after some other stuff?
 
It won't let me search case sensitive.
 
@DaggNabbit If you want to do it before or after some other stuff is exactly the point of why there are two ways of doing it.
@ckuhn203 I've tried that too :/
 
@SimonAndréForsberg ... [increment something], [other stuff] vs [other stuff], [increment something]
[increment something] == [increment something]
 
10:01 AM
@DaggNabbit Yes, but it all depends on what the "other stuff" is. a = i++; vs. a = ++i; does not result in the same value for a.
 
f(++i) vs f(i++), that is when it differs... ++i vs i++ as statements do not differ from the outside perspective... But
Now funny thing comes
When another thread reads the value, it might matter, but on the other hand, if you use no synchronization on that point, you are screwed anyway
 
If i is 1, a = i++ makes a == 1. a = ++i makes a == 2.
 
@skiwi I told yesterday that it was the worst catalog in it, it should have been an enum ;)
@skiwi and still not horny? :p
but TTGTH
 
It was still funny to look though @SimonAndréForsberg.
 
int main(void) { int i = 5; ++i; printf("%i", i); return 0; }

int main(void) { int i = 5; i++; printf("%i", i); return 0; }
compiled both of those with gcc with no options
both binaries gave exactly the same checksum
 
10:09 AM
@DaggNabbit Then apparently you have a smart compiler. I read the C/C++ answers a bit more and it seems like most of today's compilers are smart. So I edited my answer a bit (again)
 
@chillworld What... now already?
I posted an answer btw
 
@SimonAndréForsberg just reran it with -O0 (optimizations disabled). Same checksum still.
there is no difference between ++i and i++ when that's the only thing in the statement
 
Mandatory pimping:
0
A: Java enum for mapping classes and specific url

skiwiI don't think it is good practice for this sole reason: You are relating a class with its name, meaning that now you cannot refactor the class names without manually changing the enum values. This can ultimately lead to compile time errors or errors when accessing a web page, it will create maint...

 
in fact they still have the same checksum as before, so no optimizations were made before either
 
OK, are there any more edits you suggest to my answer, @DaggNabbit?
 
10:20 AM
0
Q: can you please share some sample to connect clearquest using c#

muthui have searched the dll or API to conncet the clearquest for fetching data till now i can't able to find any thing. so if anyone aware of how to connect pls guid me ASAP. if using API then where we can download the API and how to consume those servcice or if we going to user dll where i can do...

 
Off Topic^^
 
 
0
Q: Validation invoking queries?

Dr SchizoI have a question regarding whether it is viable or deemed correct if a validation object invoked a query? Essentially, I have some code that looks like this: public interface ICountryCodeValidator { IEnumberable<ValidationError> Validate(string countryCode); } public class CountryCodeValid...

 
@SimonAndréForsberg it still looks to me like you are trying to make a distinction between C/C++ and Java/C# where there isn't one. The thing you linked to is not relevant to primitive types
whether he wants to write ++i or i++ there is purely a matter of style, not performance (in any c-like language that I know of)
 
10:39 AM
@DaggNabbit Edited again
(I knew I shouldn't have mentioned this from the start... would have been so much simpler then...)
 
10:50 AM
0
Q: How to refactor the multiple `else if` codes like this?

FiregunBelow are the codes: if (clicked_id == "contain-word") { $("#specie_filter li.checked").removeClass("checked"); $("#specie_filter li:first").addClass("checked") $("#specie_filter ul").scrollTop(0) $...

0
Q: Automatic condensing of whitespace in HTML

Niet the Dark AbsolOne of the things that has occurred to me more recently is that if you add up all of the bandwidth that is taken up by thousands of users downloading the newlines and tabs used to make HTML source code readable... that's a LOT of wasted bandwidth. So I wanted to add some code that would condense...

 
@skiwi lol. That's awesome.
 
@DaggNabbit Technically, ++c is faster than c++ in C
 
@skiwi ahahahah
 
22
A: Preincrement faster than postincrement in C++ - true? If yes, why is it?

tvanfossonPost-increment usually involves keeping a copy of the previous value around and adds a little extra code. Pre-increment simply does it's job and gets out of the way. I typically pre-increment unless the semantics would change and post-increment is actually necessary.

 

« first day (433 days earlier)      last day (3576 days later) »