Page 4 of 6 [ 90 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

marshall
Veteran
Veteran

User avatar

Joined: 14 Apr 2007
Gender: Male
Posts: 10,752
Location: Turkey

03 Jun 2012, 1:09 pm

I would suspect that most viruses these days are not low level programs. Most are simply exploitative hacks. The person who makes the virus simply discovers a way to abuse features of existing software to do something that was never intended by the writers. The hard part is not writing the virus but finding the hole to exploit, which may be subtle and require some reverse engineering to discover.



03 Jun 2012, 1:22 pm

marshall wrote:
I would suspect that most viruses these days are not low level programs. Most are simply exploitative hacks. The person who makes the virus simply discovers a way to abuse features of existing software to do something that was never intended by the writers. The hard part is not writing the virus but finding the hole to exploit, which may be subtle and require some reverse engineering to discover.




I would tend to agree, actually.

The point is, I freakin' love C++. It's highly flexible, and it's quite fast. I don't believe that all programming languages are created equal. Many of the higher level languages are used for more specific kinds of programs, to which they are very efficient to use. I'm surprised by the negative view of C++ by other people ITT.



LookTwice
Velociraptor
Velociraptor

User avatar

Joined: 30 Oct 2011
Age: 114
Gender: Male
Posts: 441
Location: Lost, somewhere

03 Jun 2012, 2:35 pm

AspieRogue wrote:
I'm surprised by the negative view of C++ by other people ITT.


I'm surprised you perceive other people's balanced comments as a "negative view of C++" while you continue to say things like "Java sucks" and "C# is pathetic".
There is a reason those languages are in widespread use.



MyFutureSelfnMe
Veteran
Veteran

User avatar

Joined: 26 Feb 2010
Age: 47
Gender: Male
Posts: 1,385

03 Jun 2012, 2:47 pm

marshall wrote:
I would suspect that most viruses these days are not low level programs. Most are simply exploitative hacks. The person who makes the virus simply discovers a way to abuse features of existing software to do something that was never intended by the writers. The hard part is not writing the virus but finding the hole to exploit, which may be subtle and require some reverse engineering to discover.


All virii are exploitative hacks. Even early ones needed to exploit security vulnerabilities to, for example, write to other programs' address spaces. This is the type of thing AspieRogue was referring to when he said a low level language was needed to write a virus.



03 Jun 2012, 9:50 pm

LookTwice wrote:
AspieRogue wrote:
I'm surprised by the negative view of C++ by other people ITT.


I'm surprised you perceive other people's balanced comments as a "negative view of C++" while you continue to say things like "Java sucks" and "C# is pathetic".
There is a reason those languages are in widespread use.



I've heard that many hardc0re programmers and compuSci buffs have a very long opinion of Java. I've heard from some inside sources that Java was specifically create to catch bugs that no-so-good programmers would miss. Java is mainly used for internet programming as well as cellphone apps. I'm allowed to have my opinions, aren't I?



Shorttail
Blue Jay
Blue Jay

User avatar

Joined: 3 Feb 2012
Age: 40
Gender: Male
Posts: 95
Location: Aarhus, Denmark

04 Jun 2012, 8:27 am

Here's a protip: If you don't like critically discussing religion with people with strong opinions about religion, don't critically discuss programming languages with programmers. Things that exist and see wide use have their place in this world.

I love everyone by the way. :3



mcg
Veteran
Veteran

User avatar

Joined: 26 Jan 2010
Age: 36
Gender: Male
Posts: 538
Location: Sacramento

04 Jun 2012, 7:10 pm

AspieRogue wrote:
You're also gonna need em if you're going to write a file at some arbitrary location in memory that may involve overwriting something else.... If you wanted to overwrite part of one file and then part of another the OS isn't going to let you do that. Self-replicating programs are quite a bit more complex than you think, brah.

Not true. High-level languages can do this through API calls like WriteProcessMemory. Lots of malicious C++ programs still have to use WriteProcessMemory because pointers only allow you to write to memory in your process's own virtual address space. You can't use C file pointers to write past the end of one file and into another. File pointers are just a pointer to a FILE struct which contains a file handle for system calls along with other stuff used by the runtime library. They are not a pointer to a specific location on your disk. Under the hood, your C runtime library just makes system calls to write and read files, and the system calls obviously won't trash the file system. On linux, you can get raw disk access by opening the disk device (i.e. /dev/sda) with any language's file IO capabilities. On Windows you need a CreateFile API call, which you can do from any language.

AspieRogue wrote:
Now obviously you don't need pointers to RAM addresses to read and write files. But when it comes to self-replicating viral programs, the need for pointers(and not file pointers) has to do with they allow you to treat code as data. You could write a virus as a two part program with a "head" and a "tail". The cycle goes as the head writes the tail and the tail writes the head. C++ has a generic pointer that is not type specific. The head and the tail have pointers that reference each other.

But now I'd like to hear from MyFutreSelfnMe about how a virus can be written without pointers.

Effectively all languages have reference types, handles, or something along those lines. When you say pointers, I guess you are talking non-type safe pointers, which you can do arithmetic on and cast to different pointer types. It's worth noting that C# actually has these types of pointers, but you can only use them in an explicitly-declared unsafe environment and only run the compiled assembly under full-trust. However, there is almost no good reason for user-land code to use an unsafe pointer instead of a type-safe reference. You do not need unsafe pointers to treat code as data, and you don't necessarily need to treat code as data to write a self-replicating program.

AspieRogue wrote:
C# is fully objected oriented and was inspired by Java. I have to say, Java sucks because it's inflexible, pedantic, slow, and is particularly bad at user interfacing.
I have to disagree, at least if you're using C++ as your benchmark language. Java and C++ have a lot of the same GUI libraries, so I don't see what your complaint is there. As for the speed issue, I find that the ease of development of Java/C# programs more than outweighs the slight speed hit for all but some extremely specialized applications such as ray tracing. For business applications, Java/C# performance tends to be very comparable to C++, even with the overhead of the VM. This benefit to JIT compilation is that the VM can make optimizations that a regular compiler can't. For example, it can check if the processor supports SEE at compile-time, where a regular C++ compiler has to compile to the lowest common denominator. Also, a C#/Java compiler can make optimizations that a C++ compiler cannot due to C#/Java's strict type-safety.

AspieRogue wrote:
In addition to pointers, C++ retains the procedural aspects of C which makes writing user interfaces a lot easier and more efficient. If you have program that reads and processes user input it's SO much easier to do that with C++ and even python(using the interpreter)than with Java or C#. The void* pointer in C++ is very convenient as it offers the programmer a generic data type.
C# and Java retain the procedural aspects of C, too. They're called static methods. I don't see how OOP makes writing user interfaces harder, either. If anything, I would say the opposite is true. Compare MFC to win32 API calls or QT to GTK+. C#/Java have the object reference which is also a generic reference type. The difference is that in Java/C# you can't cast an object to anything but its underlying type and you can't directly set the memory address of the reference, which is pretty much only necessary if you have to deal with memory-mapped IO (embedded or system level programming) or have strict control over allocation patterns (stack vs heap). You're right that C++ tends to be convenient for certain classes of viruses, and you certainly couldn't write shellcode in Java/C# though you could use them to inject that shellcode. Still, most programmers are not writing these types of programs and greatly benefit from the higher level of abstraction provided by C#/.NET. Development time is expensive, and higher level languages with good libraries save tons of time writing and debugging code. At my company, we will generally just add a new server to the cluster before using my time for profiling and optimization.

AspieRogue wrote:
I've heard that many hardc0re programmers and compuSci buffs have a very long opinion of Java. I've heard from some inside sources that Java was specifically create to catch bugs that no-so-good programmers would miss. Java is mainly used for internet programming as well as cellphone apps. I'm allowed to have my opinions, aren't I?
You say that like catching bugs is a bad thing. Bugs happen, even to good programmers. Why do you think we have memory protection? Operating system designers and processor manufacturers go through great lengths to stop bugs in non-type-safe programs from interfering with other processes. Basically, each process has its own address space (so even if two processes have a pointer to the same memory address, it maps to two different pages of physical memory). Keeping track of these mappings is computationally expensive, which is why windows and linux are designed in such a way as to minimize context switching (having monolithic kernels, reserving a portion of each process's address for the kernel, etc). Are you against memory protection, too?



marshall
Veteran
Veteran

User avatar

Joined: 14 Apr 2007
Gender: Male
Posts: 10,752
Location: Turkey

04 Jun 2012, 8:53 pm

I'm sure from a business perspective, other languages can be far more safe and efficient to develop in than C/C++, at least for most practical applications. I think it's more from a recreational perspective that some people prefer a lower level language. There's more control and elegance, even if it means more tedious work and debugging time than if you used a higher level language that hides more things under the hood. It's kind of like how people who find driving a car to be a recreational activity almost always prefer manual transmission to automatic, whereas I really don't give a crap as long as the car gets me from point a to point b without breaking down. Automatic transmission has a bonus in that it frees up my right hand to more easily sip my coffee in stop and go traffic without being a danger to other drivers. In both cases arguing over which is better is a waste of time.



J-P
Velociraptor
Velociraptor

User avatar

Joined: 21 Oct 2008
Age: 37
Gender: Male
Posts: 487
Location: Montréal,Québec,Canada

17 Jun 2012, 1:23 pm

As an beginner in C++, i learn it by web and the website tell me to write this for practice:

.cpp:

#include "MaFenetre.h"

MaFenetre::MaFenetre() : QWidget()
{
setFixedSize(300, 150);

m_bouton = new QPushButton("Quitter", this);
m_bouton->setFont(QFont("Comic Sans MS", 14));
m_bouton->move(110, 50);

// Connexion du clic du bouton à la fermeture de l'application
QObject::connect(m_bouton, SIGNAL(clicked()), qApp, SLOT(quit()));

m_aPropos = new QPushButton("A Propos", this);
m_aPropos->setFont(QFont("Comic Sans MS", 14));
m_aPropos->move(119,90);

QObject::connect(m_aPropos, SIGNAL(clicked)), qApp, SLOT(aboutQt()));
}


header:

#ifndef DEF_MAFENETRE
#define DEF_MAFENETRE

#include <QApplication>
#include <QWidget>
#include <QPushButton>

class MaFenetre : public QWidget // On hérite de QWidget (IMPORTANT)
{
public:
MaFenetre();

private:
QPushButton *m_bouton;
QPushButton m_aPropos;
QPushButton m_quitter;
};

#endif


the problem i get many errors and i follow instructions. Here we go with compilator errors:

Image



LookTwice
Velociraptor
Velociraptor

User avatar

Joined: 30 Oct 2011
Age: 114
Gender: Male
Posts: 441
Location: Lost, somewhere

17 Jun 2012, 4:58 pm

J-P wrote:
QObject::connect(m_aPropos, SIGNAL(clicked)), qApp, SLOT(aboutQt()));


Don't have the time to go through the rest, but in the line above, it should be
SIGNAL(clicked())
as second argument.

J-P wrote:
QPushButton *m_bouton;
QPushButton m_aPropos;
QPushButton m_quitter;


You probably want to make m_aPropos and m_quitter pointers as well (just like you did with m_bouton).



J-P
Velociraptor
Velociraptor

User avatar

Joined: 21 Oct 2008
Age: 37
Gender: Male
Posts: 487
Location: Montréal,Québec,Canada

17 Jun 2012, 5:54 pm

LookTwice wrote:
J-P wrote:
QObject::connect(m_aPropos, SIGNAL(clicked)), qApp, SLOT(aboutQt()));


Don't have the time to go through the rest, but in the line above, it should be
SIGNAL(clicked())
as second argument.

J-P wrote:
QPushButton *m_bouton;
QPushButton m_aPropos;
QPushButton m_quitter;


You probably want to make m_aPropos and m_quitter pointers as well (just like you did with m_bouton).


Thanks dude all works. Stupid errors throught. Lol i forget pointers yeah i was needed to point this



Recycler
Butterfly
Butterfly

User avatar

Joined: 12 Jan 2012
Age: 33
Gender: Male
Posts: 16
Location: Germany

21 Jun 2012, 7:28 pm

C++ is a great language in my opinion! I've been working with Java and other languages for years, but I personally always prefer to write in C++. I feel a little bad if I don't have the power, insight and control which C++ gives to me as a programmer.


_________________
Your Aspie score: 155 of 200
Your neurotypical (non-autistic) score: 47 of 200
You are very likely an Aspie


noname_ever
Veteran
Veteran

User avatar

Joined: 25 Dec 2011
Age: 51
Gender: Male
Posts: 500
Location: Indiana

22 Jun 2012, 12:17 am

AspieRogue wrote:
LookTwice wrote:
AspieRogue wrote:
I'm surprised by the negative view of C++ by other people ITT.


I'm surprised you perceive other people's balanced comments as a "negative view of C++" while you continue to say things like "Java sucks" and "C# is pathetic".
There is a reason those languages are in widespread use.



I've heard that many hardc0re programmers and compuSci buffs have a very long opinion of Java. I've heard from some inside sources that Java was specifically create to catch bugs that no-so-good programmers would miss. Java is mainly used for internet programming as well as cellphone apps. I'm allowed to have my opinions, aren't I?


A main goal of Java back then (circa 1996) was portability. It also had a huge library built into the language.

Also, many of those "hard core" programmers wrote many bugs as well. If they wrote a program and it crashed or encountered memory corruption, they don't have room to talk.



MyFutureSelfnMe
Veteran
Veteran

User avatar

Joined: 26 Feb 2010
Age: 47
Gender: Male
Posts: 1,385

22 Jun 2012, 1:18 pm

marshall wrote:
I'm sure from a business perspective, other languages can be far more safe and efficient to develop in than C/C++, at least for most practical applications. I think it's more from a recreational perspective that some people prefer a lower level language. There's more control and elegance, even if it means more tedious work and debugging time than if you used a higher level language that hides more things under the hood. It's kind of like how people who find driving a car to be a recreational activity almost always prefer manual transmission to automatic, whereas I really don't give a crap as long as the car gets me from point a to point b without breaking down. Automatic transmission has a bonus in that it frees up my right hand to more easily sip my coffee in stop and go traffic without being a danger to other drivers. In both cases arguing over which is better is a waste of time.


I think "far more" is an exaggeration - C++ has a higher learning curve, but IMO much of that learning curve is spent learning things that make you a generally better programmer. Once you've mastered C++ I don't believe it takes significantly longer to write an application in it. Cleaning up after yourself is the main difference. Other languages' GCs work, but do have a performance impact and there are some powerful things you can do with C++'s scope based deletion that are hard to implement in other languages. Beyond that, I don't think "higher level" languages have many arguments in their favor. Java does have a performance overhead, you can see that on Android devices where the ingenious solution to avoiding "CPU diversity" issues was for everything to be done in Java. They're noticeably slower than iOS devices in a variety of situations. Performance issues are one of the leading reasons why Java was short lived as a web app development language and is now relegated to the 90s and to corporate intranet apps at companies who hire developers that don't care.

As for GUI, I don't know why, but I've never seen a Java app that I felt had a very refined UI. Including OpenOffice, which has been in development for what, more than a decade?

Do not eat or drink anything while driving.



Tomatoes
Toucan
Toucan

User avatar

Joined: 25 Jun 2012
Gender: Male
Posts: 264

27 Jun 2012, 4:33 pm

I prefer C++ to Java, but it is not easy to make the interface in win32 with Visual C++ Express because the no MFC and no resource editor. In java anything created using swing looks a bit unhealthy. And using gtk and qt on windows is not better than java. But I like java to write rapidly some programs and they can run on any platform that support java. But for making software for a specific platform and for speed of execution and resource utilisation determinism C++ is better.



MyFutureSelfnMe
Veteran
Veteran

User avatar

Joined: 26 Feb 2010
Age: 47
Gender: Male
Posts: 1,385

27 Jun 2012, 7:48 pm

That's a ridiculous limitation. Why is MS even trying to capitalize on their compiler?

http://suite101.com/article/vc-express- ... tor-a21264

I have seen far better looking UIs using Qt on Windows than I have using Java. It's been 14 YEARS since I've used Qt though so I don't remember how the API is.

GTK is a writeoff. Having to launch an X server on Windows, they might as well have not bothered porting to Windows if the port is going to be like that.