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

01 Jun 2012, 10:20 pm

MisterSpock wrote:
I have never experienced pointers, but I've heard about them, and have been told they're complete <expletives> to deal with. I briefly programmed in C++ to create a command line audio processing application. I seem to remember that it was a little annoying, but the maths wasn't too hard.

In my recent work with C# I have been able to easily create windows applications with no maths at all, and certainly no pointers. I found it much easier than C++. Is C# not suited to your needs? I'd be happy to help with C# if I could.



C# is a pathetic imitation of C++ that removes the all the good features.


Shorttail wrote:
AspieRogue wrote:
Oh yeah? Please present your evidence.

C++11 - A Touch Of Class

http://channel9.msdn.com/Events/GoingNa ... pp11-Style

"When I come into a room, especially these virtual rooms on the web, I seem to be the only one who doesn't quite know what C++ is. Everybody has some kind of simple explanation that fits their view of it and you see a few of them there [there are keywords on the screen]. And the effects is like the blind men and the elephant. If you have only seen the tail of an elephant you know what it's like, if you've only seen a leg you know what it's like. I try to look at the whole elephant and I try to characterize it, but it's hard. There's many bits to the elephant, they're all essential to the elephant, but it's hard to be simple about what it is. [...] I tried to come up with a buzzword, but I'm not particularly good at it. Lightweight abstraction programming language is accurate, but it's probably not good marketing speech."




I really don't think you appreciate how revolutionary object oriented programming is and how VITAL it is for maintaining the code of highly complex programs. It you write a complex program like a video game using a procedural language like C(there are only 2 procedural languages that are still in use today: C and FORTRAN), you'd have to write many smaller simpler programs that your master program would run. If there's a bug in one of them that causes a runtime error, the problem will cascade through the entire program and fixing it will be a time consuming, painstaking task. With object oriented programming, you have modularity. So if there's a bug in one on module, it may cause runtime errors but the rest of the program can still work(at least partially)and fixing it is that much easier.

C++ is truly the most powerful, most general purpose programming language in existence. It spans all levels, from low level hardware interfaces to high level abstraction, anything a computer can do can be programmed in C++. :wink:



Burzum
Veteran
Veteran

User avatar

Joined: 26 Apr 2011
Age: 33
Gender: Male
Posts: 1,205

01 Jun 2012, 11:04 pm

AspieRogue wrote:
C# is a pathetic imitation of C++ that removes the all the good features.

Such as...?



MyFutureSelfnMe
Veteran
Veteran

User avatar

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

02 Jun 2012, 12:16 am

AspieRogue, to be fair you could theoretically program just about anything in any language. If I wanted to badly enough (and truth told it may not be a bad idea) I could write a gcc module for Ruby and compile native code from that. Actually the more I think about it the better that one seems.

C++ hits a sweet spot on the difficulty/abstraction curve for a lot of uses. I use it almost by default for a lot of things. It's not God. :)



02 Jun 2012, 12:20 am

MyFutureSelfnMe wrote:
AspieRogue, to be fair you could theoretically program just about anything in any language. If I wanted to badly enough (and truth told it may not be a bad idea) I could write a gcc module for Ruby and compile native code from that. Actually the more I think about it the better that one seems.

C++ hits a sweet spot on the difficulty/abstraction curve for a lot of uses. I use it almost by default for a lot of things. It's not God. :)


Theoretically? Yes. IRL? Not a chance! The compilers and interpreters for high level languages like Ruby and even the Java VM are written in C++. I happen to know though that you cannot write a virus in Java, Python, or Ruby because viruses require pointers. Low level programming requires access to memory, like programming device drivers for example. Hardware access functions in languages like Ruby are not written in Ruby itself. So there you have it.



MyFutureSelfnMe
Veteran
Veteran

User avatar

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

02 Jun 2012, 8:35 pm

AspieRogue wrote:
MyFutureSelfnMe wrote:
AspieRogue, to be fair you could theoretically program just about anything in any language. If I wanted to badly enough (and truth told it may not be a bad idea) I could write a gcc module for Ruby and compile native code from that. Actually the more I think about it the better that one seems.

C++ hits a sweet spot on the difficulty/abstraction curve for a lot of uses. I use it almost by default for a lot of things. It's not God. :)


Theoretically? Yes. IRL? Not a chance! The compilers and interpreters for high level languages like Ruby and even the Java VM are written in C++. I happen to know though that you cannot write a virus in Java, Python, or Ruby because viruses require pointers. Low level programming requires access to memory, like programming device drivers for example. Hardware access functions in languages like Ruby are not written in Ruby itself. So there you have it.


I understand your line of thinking, but I maintain that if there were a reason to make these things happen in e.g. Ruby, they could. You are correct that the API would have to be expanded to expose things to Ruby code that aren't currently exposed, but on Linux there is very little that cannot be done via sysfs/procfs anyway so that's everything outside the kernel proper right there. Sure it's not portable. Portability layer could be done in Ruby. Kernel itself could be done in Ruby. There's not a huge gulf between theory and reality in this case if someone had the impetus. Note that I'm not saying any of it would be a good idea :)

You are incorrect about viruses requiring "pointers".



ruveyn
Veteran
Veteran

User avatar

Joined: 21 Sep 2008
Age: 88
Gender: Male
Posts: 31,502
Location: New Jersey

02 Jun 2012, 8:41 pm

MisterSpock wrote:
I have never experienced pointers, but I've heard about them, and have been told they're complete <expletives> to deal with. I briefly programmed in C++ to create a command line audio processing application. I seem to remember that it was a little annoying, but the maths wasn't too hard.

In my recent work with C# I have been able to easily create windows applications with no maths at all, and certainly no pointers. I found it much easier than C++. Is C# not suited to your needs? I'd be happy to help with C# if I could.


Pointers and other forms of indirect addressing add flexibility to passing parameters to subroutines.

How would you like to plug in the value of a parameter to a local variable in each of its occurrences in a subroutine. Before indirect addressing was invented that is what one had to do.

ruveyn



02 Jun 2012, 9:28 pm

MyFutureSelfnMe wrote:

You are incorrect about viruses requiring "pointers".



Oh am I? Please do elaborate. FTP when I speak of "viruses" I am talking about self-replicating programs. Some people call those "worms", but I think that's a misnomer since all a biological virus can do is self-replicate. To create a program that self-replicates you need direct access to your memory(including your hard drive-hence file pointers).



Burzum
Veteran
Veteran

User avatar

Joined: 26 Apr 2011
Age: 33
Gender: Male
Posts: 1,205

02 Jun 2012, 10:59 pm

AspieRogue wrote:
Oh am I? Please do elaborate. FTP when I speak of "viruses" I am talking about self-replicating programs. Some people call those "worms", but I think that's a misnomer since all a biological virus can do is self-replicate. To create a program that self-replicates you need direct access to your memory(including your hard drive-hence file pointers).

You don't need pointers to read files, dude.



J-P
Velociraptor
Velociraptor

User avatar

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

02 Jun 2012, 11:10 pm

Burzum wrote:
AspieRogue wrote:
Oh am I? Please do elaborate. FTP when I speak of "viruses" I am talking about self-replicating programs. Some people call those "worms", but I think that's a misnomer since all a biological virus can do is self-replicate. To create a program that self-replicates you need direct access to your memory(including your hard drive-hence file pointers).

You don't need pointers to read files, dude.


I remember barely about reading file and liked this possibility when learn about it. That give you a lot of possibilities



02 Jun 2012, 11:29 pm

Burzum wrote:
AspieRogue wrote:
Oh am I? Please do elaborate. FTP when I speak of "viruses" I am talking about self-replicating programs. Some people call those "worms", but I think that's a misnomer since all a biological virus can do is self-replicate. To create a program that self-replicates you need direct access to your memory(including your hard drive-hence file pointers).

You don't need pointers to read files, dude.



Not true. Higher level languages that have file read and write functions are calling much lower level functions that DO use pointers. A pointer is a variable that contains a memory address. To read a file your CPU needs to know where on your hard drive that data is located and where to START reading the data from.

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.



Burzum
Veteran
Veteran

User avatar

Joined: 26 Apr 2011
Age: 33
Gender: Male
Posts: 1,205

03 Jun 2012, 2:24 am

AspieRogue wrote:
Not true. Higher level languages that have file read and write functions are calling much lower level functions that DO use pointers. A pointer is a variable that contains a memory address. To read a file your CPU needs to know where on your hard drive that data is located and where to START reading the data from.

I don't think you know what you're talking about. You seem to be confusing pointers (which are used to address memory in RAM) with disk sectors. But that's irrelevant - just because higher level languages are using low level features under the hood doesn't mean that you are using those features in the language itself.

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.

...No they aren't, what's going on under the hood is irrelevant. I've written my own FAT32 filesystem in an embedded system, please don't treat me as if I don't know anything.



03 Jun 2012, 9:06 am

Burzum wrote:
AspieRogue wrote:
Not true. Higher level languages that have file read and write functions are calling much lower level functions that DO use pointers. A pointer is a variable that contains a memory address. To read a file your CPU needs to know where on your hard drive that data is located and where to START reading the data from.


I don't think you know what you're talking about.



:roll:


Quote:

You seem to be confusing pointers (which are used to address memory in RAM) with disk sectors. But that's irrelevant - just because higher level languages are using low level features under the hood doesn't mean that you are using those features in the language itself.






No, I am not confusing the two. A disk sector is a subdivision of a hard disk. Here is what msdn has to say about file pointers:

Quote:
When a file is opened, Windows associates a file pointer with the default stream. This file pointer is a 64-bit offset value that specifies the next byte to be read or the location to receive the next byte written. Each time a file is opened, the system places the file pointer at the beginning of the file, which is offset zero. Each read and write operation advances the file pointer by the number of bytes being read and written. For example, if the file pointer is at the beginning of the file and a read operation of 5 bytes is requested, the file pointer will be located at offset 5 immediately after the read operation. As each byte is read or written, the system advances the file pointer.



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.



03 Jun 2012, 9:13 am

Burzum wrote:
AspieRogue wrote:
C# is a pathetic imitation of C++ that removes the all the good features.

Such as...?



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.

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.



Burzum
Veteran
Veteran

User avatar

Joined: 26 Apr 2011
Age: 33
Gender: Male
Posts: 1,205

03 Jun 2012, 10:52 am

AspieRogue wrote:
:roll:

:roll:

AspieRogue wrote:
No, I am not confusing the two. A disk sector is a subdivision of a hard disk. Here is what msdn has to say about file pointers:

...

Yeah, genius, and how do you think it is represented under the hood? For a FAT filesystem it would be information about the current cluster, the current sector in the cluster, and the current byte offset of the sector, which is a structure specific to FAT that isn't intrinsic in any language, and certainly isn't related in any way to standard pointers. Memory isn't read from disk using a a simple pointer to an address as your previous posts seem to imply, it is read by sectors. But go ahead and tell me about how you knew all this already.

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

You said that by "virus" you mean "worm", correct? The ILOVEYOU worm was written in VBScript. Now will you concede that you don't have the slightest clue what you're talking about?



MyFutureSelfnMe
Veteran
Veteran

User avatar

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

03 Jun 2012, 1:01 pm

I don't appreciate AspieRogue's attitude. He brings up some points that would make for a valuable discussion, but then he approaches it like he already knows everything, which is clearly far from the case.



03 Jun 2012, 1:09 pm

MyFutureSelfnMe wrote:
I don't appreciate AspieRogue's attitude. He brings up some points that would make for a valuable discussion, but then he approaches it like he already knows everything, which is clearly far from the case.




Geez! I was only curious. I don't claim to "know everything", so please enlighten me. Why do you have such a stick up your ass?