That's not a problem, it's a feature.I'd like to see what happens with this "program" when presented with a file where the first character is a comma.
That's not a problem, it's a feature.I'd like to see what happens with this "program" when presented with a file where the first character is a comma.
what he did is not criticism.
their is not one damn thing wrong with how I indented my code in order for someone to read it.
You have proven him wrong by pointing out something I have not even gotten to yet.
Nor is that a realistic test. Who starts a sentence with a comma, and where do you even see that I said this is a completed program?
Nor it is written in the comments up top to do such a thing. totally unrealistic on your part.
Never the less I was working on how to save the text in another file in the same or modified text that I have not done that part yet. I jumped to that step because I felt like it, as it seems you must know.
and this is the behavior you love to see coming out of someone, you're just an enabler to his childish behavior in name calling because he did not get the response out of me he was looking for you he regressed into a childish state of mind and started his naming calling.
And you pat him on his head for it and tell him hes a good boy for his behavior. though with your childish name calling I can see that you're no better then he is, "with this shrub"
just two peas in a pod feeding each other.
I'm sure by Hodor standards this too is poorly formatted
Code:#include <linux/fs.h> /* file_operations */ #include <linux/miscdevice.h> #include <linux/mm.h> /* VM_IO */ #include <linux/module.h> #include <linux/uaccess.h> static unsigned char __HOSTLINK__[4 * PAGE_SIZE] __aligned(PAGE_SIZE); static int arc_hl_mmap(struct file *fp, struct vm_area_struct *vma) { vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot)) { pr_warn("Hostlink buffer mmap ERROR\n"); return -EAGAIN; } return 0; } static long arc_hl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { /* we only support, returning the physical addr to mmap in user space */ put_user((unsigned int)__HOSTLINK__, (int __user *)arg); return 0; } static const struct file_operations arc_hl_fops = { .unlocked_ioctl = arc_hl_ioctl, .mmap = arc_hl_mmap, }; static struct miscdevice arc_hl_dev = { .minor = MISC_DYNAMIC_MINOR, .name = "hostlink", .fops = &arc_hl_fops }; static int __init arc_hl_init(void) { pr_info("ARC Hostlink driver mmap at 0x%p\n", __HOSTLINK__); return misc_register(&arc_hl_dev); } module_init(arc_hl_init);
Last edited by userxbw; 11-15-2017 at 01:02 PM.
Normally the process for this is to open the file you want to change for reading. Then you open a new file for writing, make your changes, writing to the new file only. When you are all done, you can close and remove the old file, and close and rename the new file so that it has the same name as the old one.
In newer versions of C++ there is a filesystem library that does much of what you need to do in an object-oriented manner.
Filesystem library - cppreference.com
So to delete "my/path/to/file.txt" you would have to turn that into a path object and then call remove(). It is a similar process to rename.
If your compiler is a little older, then you ought to use the C library to remove and rename.
Personally, I think it could have been done a little better. My one real requirement for indenting, is that spacing is consistent - which it looks like you have done - and closing braces are on their own lines - which you haven't done, it looks like. While what you have posted in that regard is not perfect, I'm cutting you a break. Mostly because what you asked about is a pretty general question.their is not one damn thing wrong with how I indented my code in order for someone to read it.
Well, programmers are paranoid that users aren't cooperative. It could easily just happen.Nor is that a realistic test. Who starts a sentence with a comma, and
Nowhere. Importantly, the opportunity we have to tell you about the problem is now. It isn't a demand to immediately address it. But who knows when, if at any point, you wanted to be informed about that problem.where do you even see that I said this is a completed program?
> Nor is that a realistic test. Who starts a sentence with a comma, and
Any passing random hacker who realises that the goofball programmer has left a way in for them to exploit your system.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
that part is already in there just commented out until I get further into this program so not to have to keep rewriting a test file.
thanks for that input
Code:infile.close(); temp.close(); //remove(argv[1]); //rename("temp.txt", argv[1]); //std::ifstream tempfile(argv[1]); std::ifstream tempfile("temp.txt");
can someone say OCPD?
who made you my lord and master when it comes to where I put my brackets and how I indent my code (or for anything for that matter )?
To say you are not going to help someone with their code on the basis of how they indented and placed their brackets is arrogant. That is not helping anyone learn how to code to make the program do what it is intended to do.
when are you people going to get it into your heads coding indentation and bracket placement is personal preference,and not a requirement. If and when you get a company you then can dictate to them how you want the code written to your specifications or you will not pay them for their two weeks of work.
If you have which you should do, is go look at production code and go see all of the different manners in which it is written.
Then if you still feel that need to judge someone that you found did not indent their code or place a bracket in a place to your liking then you personally e mail them and beg for a response just to see what they tell you as well about your requirements for bracket placements and indentations. so you can see you're going to get a like response that you got from me on that matter.
no that is just him being arrogant and you showing your true colors. What did that comment in the upper part of my code state to do? no where is it a requirement to code for such a thing as well, and that final part to check for missing spaces between words. hahaha that is a big data base that would be needed for such a thing. Will I code for that? NO!
I'm finding that to be an understatement for some
what problem are you referring to? just referring to a situation when you have mentioned many "problems" that seem to be eating away at your psyche then to vaguely state " the problem" .
that whole paragraph is vaguely posed.
Last edited by userxbw; 11-15-2017 at 02:25 PM.
Your welcome. I just wanted to explain what to do in general because the seeking around the file isn't really helping you do it right.that part is already in there just commented out until I get further into this program so not to have to keep rewriting a test file.
thanks for that input
I'm giving you my opinion. You are welcome to ignore it if you like.who made you my lord and master when it comes to where I put my brackets and how I indent my code (or for anything for that matter )?
Why is your attitude so bad toward criticism in general? It really seems like whenever the thread shifts in a direction you didn't plan on, any other comments we make other than what you strictly want to talk about, you treat it like a personal attack.
The only problem being discussed is the one mentioned in post 15, because that is what you were talking about at the time. I thought it would be clear in context, because I depended on you to remember what you were talking about.what problem are you referring to? just referring to a situation when you have mentioned many "problems" that seem to be eating away at your psyche then to vaguely state " the problem" .
that whole paragraph is vaguely posed.
One can only imagine the hissy fits when user-unexploded-bomb gets their first code review at their first job.
Might just be their last code review.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
But there needs to be a system to it, and some styles are clearly more readable than others. And programming is an area where order is of particular importance. The analogous situation here would be that you're a writer and want others to give their opinion on your work in progress. If your grammar makes the story hard to read, it's not nitpicky for said readers point that out to you, even if it has nothing to do with story itself.Originally Posted by userxbw
You're being unnecessarily abrasive, especially to whiteflags who tried to cut you some slack (if you haven't noticed).
I agree that their needs to be a "format to it for readability" even I find myelf getting anal over how I indent and close off my codes but to try and say what I have posted in here is not readable it is a mess ? Let me go mess it up and make it really hard to make sense of
for her to say it is not "formatted perfectly" so she is going to cut me a break .
. not perfect to whos standards? their is no standard.
so yes who made her Lord and Master over how I indent and use me brackets I can say the same about her formatting of code if I wanted to.
Formatting is just someone idea and maybe a few others agreeing, " yeah I like it if it was written like this", then someone comes along and says no, I like it this way better. it is just an option the compiler could care less. If it really mattered in a long run then it'd not compile until it was formatted a certain way, there are only a few old languages that have this requirement. C and C++ and Pascal and Java to name s few are NOT one of them.
the code itself is more important then the way it is formatted. what good is it to have it all pretty looking just the way YOU want it if it does not even work? that is a waste of time, spend more time trying to get it to look pretty then get it to work. great time management going on there.
etc...
Last edited by userxbw; 11-15-2017 at 04:49 PM.
I couldn't read it because it wasn't formatted correctly. I "scan" code, not read every single statement, for my first pass over newly presented code and your (lack of) formatting made that impossible (not to mention the lack of functions and structure in general).
Yes, formatting style is a personal choice, unless you work for someone else in which case you should follow the style of your employer.Formatting is just someone idea and maybe a few others agreeing,
However few people will argue that using an inconsistent style is a good practice. Consistency is one of the biggest factors that make reading "foreign" code easier to read.
I would tend to disagree with this statement. IMO, if the code is hard to read because of poor formatting it will be much harder to tell if the code is really working correctly. So I would say that proper formatting should be as important as the code itself. And with today's auto formatting editors it should be easier to maintain proper formatting than writing code that functions as expected.the code itself is more important then the way it is formatted.
By the way, while I think your code needs work on the consistency front, I don't consider the code you posted in this topic that horrible. Could it be improved, yes. Is it worth throwing tantrums from either side, doubtful.
the order of importance
get the code to work
then make it look purrrrrty
trying to keep it is somewhat an ordered fashion while trying to get it to work would be advisable as apposed to tabbed and spaced and lined in a haphazard fashion even the one coding it is having a hard time figuring out what he or she is doing. Bracket happy people bug me but I am no in here telling them it is not the way to do it. If I copy paste and play with the code I may change it to make it easier for me to read though
Consistency is one of the biggest factors that make reading "foreign" code easier to read.
too can be cause for argument. one mans consistency is not another mans consistency. to make "foreign" code easier to read.
evenCode:if ( true) { do this } else if ( true ) { do this } else { do this } // when it is legal to do this if ( true) do this else if ( true) do this else do this // this is legal, no brackets for ( int i = 0; i < 10; i++) if ( true) do this // what rules control that code flow? // where most will say it has to be like this. for ( int i = 0; i < 10; i++) { if ( true) { do this } } // when it does not have to be // but there are them that will //complain and criticize it // trying to get the coder // to conform to // there ridged mind set.
so who is right and who is wrong?Code:if ( true ) do this; // is the same as if ( true ) do this // is the same as if (true) { do this } //is the same as if (true) { do this } //even if (true) { do this; and this; and this; }
no one is right or wrong.
Last edited by userxbw; 11-15-2017 at 06:02 PM.
I give up. You obviously have no intention of learning or even trying to become a better programmer.