Jump to content


  • Content count

  • Joined

  • Last visited


This user doesn't have any awards

1 Follower

About Yamoto42

  • Title


  • CPU
  • Motherboard
    ASUS X99-A/USB 3.1
  • RAM
    32GB Corsair Vengeance LPX DDR4-2400
  • GPU
    Gigabyte GTX 980Ti G1 Gaming
  • Case
    Phanteks Enthoo Luxe - White
  • Storage
  • PSU
    EVGA 850G2
  • Display(s)
    3x ASUS VN289QL
  • Cooling
    Corsair H110i GT
  • Keyboard
    Corsair K70 w/ Cherry MX Brown
  • Mouse
  • PCPartPicker URL

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

345 profile views
  1. C Programming

    @Unimportant And I do agree as a rule of thumb. J = C+x && J = C <-> x = 0 But the C STANDARD does not guarantee x=0, or that x > 0, or x < 0. Undefined literally means we know nothing about x. It could be negative, making C slower for all the language should assume. And you'd have to be a certain kind of stupid to use an implementation of C where x<=0...which is while it's not TECHNICALLY correct, I do agree in general.
  2. C# Array vs List

    In object oriented programming, there is a concept of abstract and concrete types. Concrete types are what you are likely familiar with. They consist of data, methods, etc. Abstract classes are similar to concrete classes, except they may have data or methods that are DECLARED, but not DEFINED. As an example: public class Concrete { public Int32 GetAnInt() { return 42; } public Int64 GetALong() { return 1234567890; } } public abstract class Abstract { public Int32 GetAnInt() { return 64; } public abstract Int64 GetALong(); } Now, because the definition of Abstract is incomplete, you cannot call its constructor...but don't worry about that for now. We have a special case for classes where NOTHING is defined. We call them interfaces. // By convention in C# we start them with an uppercase I public interface INumberMaker { In32 GetAnInt(); } public class Spam : INumberMaker { public In32 GetAnInt() { return 42; } } public class Eggs : INumberMaker { public In32 GetAnInt() { return 64; } public In64 GetALong() { return 42; } } Now for teh code ... INumberMaker myNum = new Spam(); System.out.println(myNum.GetAnInt()); // Will print 42 myNum = new Eggs(); System.out.println(myNum.GetAnInt()); // Will print 64 System.out.println(myNum.GetALong()); // Will not compile ... What we have effectively done is said "I don't care what myNum is, as long as it has a method called GetAnInt() that returns an Int32." The second time we assign it, it may have a method called GetALong...but we don't care. By DECLARING it of type INumberMaker, even though we INSTANTIATED eggs, we have explicitly said INumberMaker and its GetanInt() method is all we care about. That's what interfaces are used for. We declare what matters, for example IList<T> defines what MAKES a list, but not how it is implemented. It says what does a list do? It stores items an a specific order, allows retrial based on their order, etc... It doesn't say how they are stored, only that they exist and what method names will be used to access them. (this is called an API) List<T> then says "lets store it as an array" and LinkedList<T> says "Lets store it as a path of nodes". But they both implement IList<T>. ...and in this case your code should care about how it's ACCESSED, not how its STORED. That decision only has to be made once...and it may often change. If your code needs to know how its stored, you've probably put too much responsibility on a single area. Let the initialization worry about how its stored, let the accessor only worry about how its accessed.
  3. C Programming

    I do understand what you are saying. And no reasonable implementer of the the C language would perform a bound check on the array access...or for that matter differentiate it from pointer arithmetic...much like no reasonable C programmer would not take the time (read development cost) to write the check themselves before making the access in any non-trivial situation. But a rule of thumb is not necessarily technically correct. The thing is this: Speed is in no way an attribute of the language. It is entirely an attribute of implementation. I keep bringing up Turing completeness because its core concept creates contradiction when speed is considered an attribute of the language. If a language, lets call it A (C wat I did thar?), is Turing complete, then by the definition of Turing completeness I can write an interpreter for A in the A language itself...That quality is exactly what lets you write a C compiler in C. Now, if you write a program in A, and compile it with Richard M. Stalin's latest gaa compiler, then run it in my A interpreter, then only two results are possible: They finish at the exact same time or one finishes before the other (it doesn't matter which one is first). Now, since my A interpreter is doing effectively run-time compilation AND execution, it is performing more computation than the result of gaa. From this, if the programs complete at the same time, since the extra work included the execution time of both must have been zero. Both execute your program A, but one has run-time compilation overhead. A * n = A * (n+x) -> A = 0...so I feel comfortable throwing that out saying they won't finish simultaneously. But what happens if they don't finish simultaneously? Well, if speed is an attribute of the language and not the implementation you are effectively saying A != A. //======== In practice, however, the latter will tend to be true. They will not finish simultaneously. However, it is not a contradiction because the difference comes from the native language vs. interpreted IMPLEMENTATIONS. In fact, it's largely a moot point because my computer doesn't speak C, java, or python. It only speaks x86...if anything we're more debating compilers than languages... But as a rule of thumb, I fully agree a program written in C will halt faster than a program written to perform the same task in Java or Python....but the key phrase is "rule of thumb".
  4. C Programming

    The key words there is ALLOWS. It is undefined behavior by the standard. As soon as you use the word "default", you have defined it. Undefined by the standard is absence of evidence, not evidence of absence. Ultimately, there is no one tool for the job. The three properties of a produce are fast, cheap, and good. Realistically you'll at best get to choose 2....typically 1 and a half... C does teach you a lot of about how a computer works. Definitely more so than any other high level language. Unfortunately, to use your own example, that includes bounds checking arrays. I wouldn't even pay minimum wage for a C developer that skipped their own bounds check in a non-trivial situation...and because we need to prevent such undefined behavior, that leads to a lot of what is essentially redundant boilerplate code. It leads to frequently re-inventing the wheel. While I would highly advocate learning C (if you're a serious developer), I would recommend C++, Java, C# or python first, and THEN learning C. You don't have to be able to build a transmission to be an excellent driver...but If you later (after you've gotten your feet a little wet just driving around town) want to, I highly recommend at least learning how transmissions and differentials work; or even what they do. You don't learn English by translating the complete works of Shakespear from their original Klingon. That comes later. At least learn to say "Hello World" first. Similarly, knowing and understanding something does not in any imply that the solution will be correct. The heartbleed bug is a good (potentially catastrophic) example of this. But I digress...C does teach you a lot of things, and knowing what's going on under the hood can extremely helpful for debugging and finding optimizations in other languages...and even for that alone I would recommend learning it. But even then I can't say I would use it for a new project if C++ were available.
  5. C Programming

    @Sebivor You can't convince a true believer. If they can't see the inherent contradiction in saying Turing complete languages operate at different speeds when the fundamental core of Turing completeness is recursive equivalency...
  6. C Programming

    What is 143726 * 9304723 / 5? No calculator, pencil or paper. Just because you know something exists or how it works in absolutely no way means you will get it right.
  7. C Programming

    This. The fundamental concept of Turing completeness.
  8. C# Array vs List

    Exactly what I was getting it: designing around abstractions so he can easily change his mind later...or even based on different situations. I used the word "declare" specifically to differentiate it from instantiation. He obviously still has to use a concrete implementation...but beyond the constructor "ideally" that shouldn't be referenced again unless he absolutely requires it...but if that were the case this question would likely be moot from the start. The same thing stands for IDictionary. The only thing here I don't quite understand is what hes trying to accomplish with #2...he says "They need to be at the same index so I can find the WWW based on the contents of the String."...if they are at the same index what sort of searching does he need to do? I think i understand what he's trying to do (create a pointer to another collection)...but I don't understand why it's necessary, or what searching has to do with it.
  9. C Programming

    It's understandable if you know how varargs work in c/c++. You have to know the data types (which are lost at compile time) in order to do proper formatting and retrieval from the stack. <stdarg.h> More modern langues are interpreted or have a runtime environment where that information isn't lost. @Br3tt96 Don't be afraid to ask questions, and a lot of them; as many as are necessary...and then maybe a few more for good measure. It's always better to err on the side of too many questions now so you don't end up five topics later having missed them all because you didn't understand the foundation.
  10. C# Array vs List

    Why are you even considering an array? List<T> is implemented as an array...so you still get the constant time access...and potentially quadratic expansion time. But mainly: don't declare it as an array or a List<T>. Use an IList<T>. In c#, arrays actually implement this interface as well, so (since you say you aren't altering ti after initialization) the majority of your code it doesn't particularly matter what you use.
  11. How many built-in classes does C# have?

    I reckon 'bout a few.
  12. The great language debate !!!

  13. C# Kinda stupid - but how do I get this to save...

    Probably WinForms, judging by the DialogResult return type.. WPF version returns a Nullable<Boolean>. You can still use the WinForms dialog in WPF...but yeah... @Alexp10v2, either open a filestream from the filename, or the dialog can open it for you it with SaveFileDialog::OpenFile().
  14. There's your problem: UDP doesn't have the concept of connections. Transmission is fire-and-forget, and Listen is the same.
  15. This pretty much sums up my opinion on it... Except support. Java has almost infinitely better support on non-M$ machines...although C# may be trying to escape. The real question is "Is Java too ingrained for C#, even if open sourced, to get a footing outside Microsoft?" Unfortunately I suspect the answer to be "Yes." It's not dissimilar to perl vs python. python as a language is so much better. People had to learn it [perl] when it was the best (and potentially only) tool of its kind, then when starting future projects they used what they knew instead of looking at new tools first. The only reason python has been successful in that regard is it did not start with the proprietary baggage C# has.