Optimized (?)
-
Spot the Difference.... The optimizer got a bit carried away with this: (Excuse the tab's - cant seem to get that working!) The problem is in the "QUEUES FAILED" message Debug Build:
public SOAPResult CreateTable(PosResource resource)
{
// right then, time to lock the
// tableint resultCode = 1; string resultText = string.Empty; string tablesFolder = ConfigurationSettings.AppSettings\[TABLES\_FOLDER\_KEY\]; // get the table file string tableFile = Path.Combine(tablesFolder, string.Format("{0}.xml", resource.Name)); string lockFile = Path.Combine(tablesFolder, string.Format("{0}.{1}", resource.Name, resource.OriginatingTillId)); if(File.Exists(tableFile)) { resultCode = -1; resultText = "TABLE EXISTS"; } else { // create the message envelope for the lock MessageEnvelope envelope = new MessageEnvelope(MessageType.Lock, resource); // attempt to write the queues (apart from central) if(MessagingHelper.WriteEnvelopeToAllQueues(envelope, false)) { // create the lock using(File.CreateText(lockFile)) { // release } // create the table using(File.CreateText(tableFile)) { // release } } else { resultCode = -1; resultText = "QUEUES FAILED"; } } return new SOAPResult(resultCode, resultText);
}
Decompiled Release Build with some strange optimization
public SOAPResult CreateTable(PosResource resource)
{
int num1 = 1;
string text1 = string.Empty;
string text2 = ConfigurationSettings.AppSettings
["SOAPInterface.TableInterface.TablesFolder"];
string text3 = Path.Combine(text2, string.Format("{0}.xml",
resource.Name));
string text4 = Path.Combine(text2, string.Format("{0}.{1}",
resource.Name, resource.OriginatingTillId));
if (File.Exists(text3))
{
num1 = -1;
text1 = "TABLE EXISTS";
}
else
{
MessageEnvelope envelope1
= new MessageEnvelope(MessageType.Lock, resource);
if (MessagingHelper.WriteEnvelopeToAllQueues(envelope1,
false))
{
StreamWriter writer1 = File.CreateText(text4);
if (writer1 != null)
{
writer1.Dispose();
}
writer1 = File.CreateText(text3);
if (writer1 != null)
{
writer1.Dispose();
} -
Spot the Difference.... The optimizer got a bit carried away with this: (Excuse the tab's - cant seem to get that working!) The problem is in the "QUEUES FAILED" message Debug Build:
public SOAPResult CreateTable(PosResource resource)
{
// right then, time to lock the
// tableint resultCode = 1; string resultText = string.Empty; string tablesFolder = ConfigurationSettings.AppSettings\[TABLES\_FOLDER\_KEY\]; // get the table file string tableFile = Path.Combine(tablesFolder, string.Format("{0}.xml", resource.Name)); string lockFile = Path.Combine(tablesFolder, string.Format("{0}.{1}", resource.Name, resource.OriginatingTillId)); if(File.Exists(tableFile)) { resultCode = -1; resultText = "TABLE EXISTS"; } else { // create the message envelope for the lock MessageEnvelope envelope = new MessageEnvelope(MessageType.Lock, resource); // attempt to write the queues (apart from central) if(MessagingHelper.WriteEnvelopeToAllQueues(envelope, false)) { // create the lock using(File.CreateText(lockFile)) { // release } // create the table using(File.CreateText(tableFile)) { // release } } else { resultCode = -1; resultText = "QUEUES FAILED"; } } return new SOAPResult(resultCode, resultText);
}
Decompiled Release Build with some strange optimization
public SOAPResult CreateTable(PosResource resource)
{
int num1 = 1;
string text1 = string.Empty;
string text2 = ConfigurationSettings.AppSettings
["SOAPInterface.TableInterface.TablesFolder"];
string text3 = Path.Combine(text2, string.Format("{0}.xml",
resource.Name));
string text4 = Path.Combine(text2, string.Format("{0}.{1}",
resource.Name, resource.OriginatingTillId));
if (File.Exists(text3))
{
num1 = -1;
text1 = "TABLE EXISTS";
}
else
{
MessageEnvelope envelope1
= new MessageEnvelope(MessageType.Lock, resource);
if (MessagingHelper.WriteEnvelopeToAllQueues(envelope1,
false))
{
StreamWriter writer1 = File.CreateText(text4);
if (writer1 != null)
{
writer1.Dispose();
}
writer1 = File.CreateText(text3);
if (writer1 != null)
{
writer1.Dispose();
}Why has this been voted down? I don't see it as a programming question but more like a "hey, look what happened to my code! I guess is a compiler bug". If he were asking on what to do to fix it, it would be a programming question. But not this... or so I think! -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
-
Spot the Difference.... The optimizer got a bit carried away with this: (Excuse the tab's - cant seem to get that working!) The problem is in the "QUEUES FAILED" message Debug Build:
public SOAPResult CreateTable(PosResource resource)
{
// right then, time to lock the
// tableint resultCode = 1; string resultText = string.Empty; string tablesFolder = ConfigurationSettings.AppSettings\[TABLES\_FOLDER\_KEY\]; // get the table file string tableFile = Path.Combine(tablesFolder, string.Format("{0}.xml", resource.Name)); string lockFile = Path.Combine(tablesFolder, string.Format("{0}.{1}", resource.Name, resource.OriginatingTillId)); if(File.Exists(tableFile)) { resultCode = -1; resultText = "TABLE EXISTS"; } else { // create the message envelope for the lock MessageEnvelope envelope = new MessageEnvelope(MessageType.Lock, resource); // attempt to write the queues (apart from central) if(MessagingHelper.WriteEnvelopeToAllQueues(envelope, false)) { // create the lock using(File.CreateText(lockFile)) { // release } // create the table using(File.CreateText(tableFile)) { // release } } else { resultCode = -1; resultText = "QUEUES FAILED"; } } return new SOAPResult(resultCode, resultText);
}
Decompiled Release Build with some strange optimization
public SOAPResult CreateTable(PosResource resource)
{
int num1 = 1;
string text1 = string.Empty;
string text2 = ConfigurationSettings.AppSettings
["SOAPInterface.TableInterface.TablesFolder"];
string text3 = Path.Combine(text2, string.Format("{0}.xml",
resource.Name));
string text4 = Path.Combine(text2, string.Format("{0}.{1}",
resource.Name, resource.OriginatingTillId));
if (File.Exists(text3))
{
num1 = -1;
text1 = "TABLE EXISTS";
}
else
{
MessageEnvelope envelope1
= new MessageEnvelope(MessageType.Lock, resource);
if (MessagingHelper.WriteEnvelopeToAllQueues(envelope1,
false))
{
StreamWriter writer1 = File.CreateText(text4);
if (writer1 != null)
{
writer1.Dispose();
}
writer1 = File.CreateText(text3);
if (writer1 != null)
{
writer1.Dispose();
}Did you not see the big red message at the top of the window when you posted this? Please do NOT post programming questions or ads to this forum. This would have been more appropriate in the C# Forum. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Did you not see the big red message at the top of the window when you posted this? Please do NOT post programming questions or ads to this forum. This would have been more appropriate in the C# Forum. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
It was not a programming question... If you took the time to determine it was C# code, you might have taken the time to read the message too.
Ðavid Wulff Audioscrobbler :: flickr Die Freiheit spielt auf allen Geigen (video)
-
Why has this been voted down? I don't see it as a programming question but more like a "hey, look what happened to my code! I guess is a compiler bug". If he were asking on what to do to fix it, it would be a programming question. But not this... or so I think! -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
It has code in it and makes me scroll the page down when open. Thus it is as bad as any programming question.
Jonathan 'nonny' Newman blog.nonny.com [^]
-
Spot the Difference.... The optimizer got a bit carried away with this: (Excuse the tab's - cant seem to get that working!) The problem is in the "QUEUES FAILED" message Debug Build:
public SOAPResult CreateTable(PosResource resource)
{
// right then, time to lock the
// tableint resultCode = 1; string resultText = string.Empty; string tablesFolder = ConfigurationSettings.AppSettings\[TABLES\_FOLDER\_KEY\]; // get the table file string tableFile = Path.Combine(tablesFolder, string.Format("{0}.xml", resource.Name)); string lockFile = Path.Combine(tablesFolder, string.Format("{0}.{1}", resource.Name, resource.OriginatingTillId)); if(File.Exists(tableFile)) { resultCode = -1; resultText = "TABLE EXISTS"; } else { // create the message envelope for the lock MessageEnvelope envelope = new MessageEnvelope(MessageType.Lock, resource); // attempt to write the queues (apart from central) if(MessagingHelper.WriteEnvelopeToAllQueues(envelope, false)) { // create the lock using(File.CreateText(lockFile)) { // release } // create the table using(File.CreateText(tableFile)) { // release } } else { resultCode = -1; resultText = "QUEUES FAILED"; } } return new SOAPResult(resultCode, resultText);
}
Decompiled Release Build with some strange optimization
public SOAPResult CreateTable(PosResource resource)
{
int num1 = 1;
string text1 = string.Empty;
string text2 = ConfigurationSettings.AppSettings
["SOAPInterface.TableInterface.TablesFolder"];
string text3 = Path.Combine(text2, string.Format("{0}.xml",
resource.Name));
string text4 = Path.Combine(text2, string.Format("{0}.{1}",
resource.Name, resource.OriginatingTillId));
if (File.Exists(text3))
{
num1 = -1;
text1 = "TABLE EXISTS";
}
else
{
MessageEnvelope envelope1
= new MessageEnvelope(MessageType.Lock, resource);
if (MessagingHelper.WriteEnvelopeToAllQueues(envelope1,
false))
{
StreamWriter writer1 = File.CreateText(text4);
if (writer1 != null)
{
writer1.Dispose();
}
writer1 = File.CreateText(text3);
if (writer1 != null)
{
writer1.Dispose();
}Sure its not just the decompiling software you are using? Reflector has a few such bugs. Eg Code:
inputBuffer[i] ^= outputBuffer[i];
Reconstructed code:(buffer2 = inputBuffer)[(int) (ptr1 = (IntPtr) num1)] = (byte) (buffer2[(int) ptr1] ^ outputBuffer[num1]);
All 'buffer' arebyte[]
. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots -
It was not a programming question... If you took the time to determine it was C# code, you might have taken the time to read the message too.
Ðavid Wulff Audioscrobbler :: flickr Die Freiheit spielt auf allen Geigen (video)
-
It was not a programming question... If you took the time to determine it was C# code, you might have taken the time to read the message too.
Ðavid Wulff Audioscrobbler :: flickr Die Freiheit spielt auf allen Geigen (video)
David Wulff wrote: It was not a programming question... But it's like... just imagine for a moment you are a hard working lumberjack. After a hard day of hard work (jacking lumber?) you sit down in the pub with your lumberjack buddies, and chill with a beer, and discussing important things like suspenders brand, bra sizes and shopping. In comes Joe Lumberjack Doe, and starts talking about cubic feet and machines and oil and stuff. No, it was not a programming question, and I'd like to see more such things in the lounge, but most loungers want their lounge free of code.
Pandoras Gift #44: Hope. The one that keeps you on suffering.
aber.. "Wie gesagt, der Scheiss is' Therapie"
boost your code || Fold With Us! || sighist | doxygen -
It was not a programming question... If you took the time to determine it was C# code, you might have taken the time to read the message too.
Ðavid Wulff Audioscrobbler :: flickr Die Freiheit spielt auf allen Geigen (video)
Not really. The ton of semi-colons was a dead giveaway without even reading a single line of code. I stand by what I posted simply because the end result of his post had way too much potential of breaking down into a programming dialog. I really don't give a crap if I got rated a 1 or not. I posted what I was thinking. Isn't that what the Lounge is all about? :) RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Not really. The ton of semi-colons was a dead giveaway without even reading a single line of code. I stand by what I posted simply because the end result of his post had way too much potential of breaking down into a programming dialog. I really don't give a crap if I got rated a 1 or not. I posted what I was thinking. Isn't that what the Lounge is all about? :) RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave Kreskowiak wrote: The ton of semi-colons was a dead giveaway without even reading a single line of code. C# is the only language with semi-colons? :rolleyes: You have to read at least a little code to know it's C# ;P Gary Kirkham Forever Forgiven and Alive in the Spirit He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot Me blog, You read
-
Well I took his post to mean "look at this crazy thing!" which has been done safely in the Lounge since it began. If it was in the C# forum it would only get C# developers looking at it, which is not what he wanted.
Ðavid Wulff Audioscrobbler :: flickr Die Freiheit spielt auf allen Geigen (video)
-
Not really. The ton of semi-colons was a dead giveaway without even reading a single line of code. I stand by what I posted simply because the end result of his post had way too much potential of breaking down into a programming dialog. I really don't give a crap if I got rated a 1 or not. I posted what I was thinking. Isn't that what the Lounge is all about? :) RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
A post having potential of breaking down into a programmming dialogue does not making something a programming question. If we ban everything related to software development, the Lounge will have no content. That is afterall what we do. Far too many people are overly sensitive to jumping on people asking innocent questions or, in this case, showing us something stupid the compiler did. We've had posts talking about new features in future versions of C#, how to code Greasemonkey scripts, all sorts of things that were similar in content to James' post, and they were all allowed with a lynching. Heck this morning I posted a link to a Daily WTF entry which was precisely what this thread was meant to be, and I got voted consecutive 5's for it. Why? Well probably because I didn't draw attention to it by using <pre> blocks, otherwise it too would have attracted the kneejerk 1 voters. The technical forums are for techical questions/advice, not stuff like this.
Ðavid Wulff Audioscrobbler :: flickr Die Freiheit spielt auf allen Geigen (video)
-
Sure its not just the decompiling software you are using? Reflector has a few such bugs. Eg Code:
inputBuffer[i] ^= outputBuffer[i];
Reconstructed code:(buffer2 = inputBuffer)[(int) (ptr1 = (IntPtr) num1)] = (byte) (buffer2[(int) ptr1] ^ outputBuffer[num1]);
All 'buffer' arebyte[]
. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - ScreenshotsI decompiled it becuase the code was executing incorrectly, basically it was returning the error condition always. The optimizer actually changed the logic! :) James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch Hedberg -
I decompiled it becuase the code was executing incorrectly, basically it was returning the error condition always. The optimizer actually changed the logic! :) James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch HedbergThat WriteToAllQueues function, does it return the 2nd parameter unchanged perhaps? xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
-
That WriteToAllQueues function, does it return the 2nd parameter unchanged perhaps? xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
It returns a True, which is a successfully write. It makes you wonder about the optimizer really, it could introduce subtle problems with release code. James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch Hedberg