The tag has no wiki summary.

learn more… | top users | synonyms

8
votes
5answers
7k views

Why can you have the method definition inside the header file in C++ when in C you cannot?

In C, you cannot have the function definition/implementation inside the header file. However, in C++ you can have full method implementation inside the header file. Why is the behaviour different?
23
votes
7answers
2k views

Is it good practice to rely on headers being included transitively?

I'm cleaning up the includes in a C++ project I'm working on, and I keep wondering whether or not I should explicitly include all headers used directly in a particular file, or whether I should only ...
26
votes
4answers
18k views

Why is #include <iostream.h> bad?

I was reading another thread where a guy asked about C++ books for beginners, and one of the programmers answering wrote this: Some warnings: avoid all books that present an "hello world" stating ...
2
votes
2answers
3k views

Is it safe to transmit access tokens via HTTP headers?

It's the first RESTful web service and I am concerned about security issues. Is it safe to transmit my access token via HTTP headers? For example: POST /v1/i/resource HTTP/1.1 Content-Type: ...
0
votes
0answers
85 views

When are request headers read by ASP.NET code

I've got an issue with my MVC 4 website where iOS Safari is automatically sending the DNT header with the first request to the site. Here's my question on StackOverflow. Even though the iPhone has the ...
0
votes
0answers
62 views

Consistent header HTML across multiple sites

We've got several sites. Some are HTML/Angular, some are built on a CMS, some are built on other code. What we'd like to do is have a consistent header experience for each site. I'm trying to figure ...
3
votes
7answers
1k views

Why do we need to include the .h while everything works when including only the .cpp file?

Why do we need to include both the .h and .cpp files , while we can make it works with making just a .cpp file and then including it . For example, Creating a file.h containing declarations, then ...
3
votes
2answers
3k views

Custom use of Authorization header in a REST API

I'm building a REST api where clients are authenticated using client certificates. A client in this case is not an individual user, but some sort of a presentation layer. Users are authenticated using ...
1
vote
1answer
376 views

Splitting and hiding headers in a static library

I am writing a static library for C/C++ (personal project). As my headers became rather large, I thought that splitting my headers would be a good idea. Right now a header looks like this: ...
6
votes
4answers
1k views

Ways to organize interface and implementation in C++

I've seen that there are several different paradigms in C++ concerning what goes into the header file and what to the cpp file. AFAIK, most people, especially those from a C background, do: foo.h ...
1
vote
2answers
515 views

Why are header files bad design? [duplicate]

this says header files are bad design, but I don't know why. The answers specified there are about the inefficiency of header file when building. Why it is bad design is not really touched upon. As ...
0
votes
1answer
76 views

How to POST CSV with XMLHttpRequest

I would like to send a CSV file via POST in a XMLHttpRequest, but I am unsure of two things. First is there anything to distinguish a CSV file from a string split up by comma's? And what sort of ...
0
votes
1answer
24 views

How to use specific Request Header [closed]

I am learning how to work with XMLHttpRequests. I know that request.setRequestHeader() is an important factor. I just don't understand why. It took me a while but I have at least found a list of ...
8
votes
5answers
13k views

What should and what shouldn't be in a header file? [closed]

What things should absolutely never be included in a header file? If for example I'm working with a documented industry standard format that has a lot of constants, is it a good practice to define ...
1
vote
3answers
194 views

Requiring a specific order of compilaiton

When designing a compiled programming language, is it a bad idea to require a specific order of compilation of separate units, according to their dependencies? To illustrate what I mean, consider C. ...
8
votes
2answers
657 views

Updating copyright headers each new year just because Jan 1st has passed? [duplicate]

I've seen some projects that - with each new year - start to change all files in their source-tree to update the copyright year. Isn't this just pushing hot air on a level of magnitude? AFAIK: ...
2
votes
1answer
286 views

PHP high traffic default page

I have a php website that will be experiencing high levels of traffic in a few weeks. We scaled the servers to accept the traffic, but want some sort of fallback page in the event that something ...
22
votes
3answers
7k views

Why do we need to put private members in headers?

Private variables are a way to hide complexity and implementation details to the user of a class. This is a rather nice feature. But I do not understand why in c++ we need to put them in the header of ...
-1
votes
1answer
131 views

Take dynamic PHP array, package up as separate files inside a single zip file

I have this dynamic data in PHP, but for each array record, I want to allow a downloadable option to save a zip archive of all records (each as a separate file). These are actually DNS zone records ...
2
votes
0answers
137 views

Web revisioning and the Accept-Datetime header

I have been in the process of generating documentation for an upcoming project. One of the features of the data available in this project is that it will be revisioned (or at least large parts of it ...
21
votes
6answers
9k views

Is it better to document functions in the header file or the source file?

In languages that distinguish between a "source" and "header" file (mainly C and C++), is it better to document functions in the header file: (pilfered from CCAN) /** * time_now - return the ...
3
votes
1answer
102 views

Handling bugs, quirks, or annoyances in vendor-supplied headers

If the header file supplied by a vendor of something with whom one's code must interact is deficient in some way, in what cases is it better to: Work around the header's deficiencies in the main ...
1
vote
1answer
137 views

How do I parse a header with two different version [ID3] avoiding code duplication?

I really hope you can give me some interesting viewpoints for my situation, because I am not satisfied with my current approach. I am writing an MP3 parser, starting with an ID3v2 parser. Right now ...
1
vote
3answers
542 views

Common header file for C++ and JavaScipt

I have an app that runs a C++ server backend and Javascript on the client. I would like to define certain strings once only, for both pieces of code. For example, I might have a CSS class ...
1
vote
2answers
764 views

What's special in July 26th and why is it used in examples for Expires header so often?

I've noticed that July 26th (my birthday) is used really often in various PHP examples related to preventing http caching using Expires header, like: ...
2
votes
2answers
564 views

What is the purpose of including header files in the solution in Visual Studio?

So I have including the files to my projects by simply : #include "myheader.hpp" and adding the headers into the solution explorer. But recently I have realized that I may omit the step of adding the ...
21
votes
3answers
9k views

Copyright statements in source code [closed]

Ever since I started programming I've seen a header at the top of most code files indicating some sort of copyright: e.g. /* Copyright (c) 1998 Innotech */ or /* Copyright (c) 1998-2008 Innotech ...
1
vote
2answers
2k views

Finding header files

A C or C++ compiler looks for header files using a strict set of rules: relative to the directory of the including file (if "" was used), then along the specified and default include paths, fail if ...
1
vote
3answers
516 views

Should non-interface code be hidden from the client?

I am working on a library which had several headers that are meant to only be used by the library itself. I also have a few classes and functions in headers that I do not want the client to use. For ...
7
votes
5answers
6k views

Why do we need to write a header file?

Before you whip out your snarky comments, I know -- this is a nooby question. This is my first time using a C based language. I'm an undergrad student learning Objective C for a computer science ...
0
votes
1answer
138 views

What are the benefits of not including other header files in a header file?

Sometimes, a header file uses objects that are in declared in other header files. The user of this header file would have to include the dependency anyway and get the order correct too.
0
votes
2answers
412 views

Is it a good idea to use Header(“Content-Type […]”); in the core file of a CMS?

I have been working on content management systems for about 7 years. 2 years ago created my own. Currently building a newew, better and bigger version. However, fell into dilemma. I have a core file, ...
5
votes
1answer
5k views

Header comment format

I realize that the "header comment" format varies from programmer to programmer, but what would be an example of a "good" header comment?
5
votes
7answers
572 views

Which languages use “paired” header/implementation files?

C is ubiquitous, and C++ nearly as much, but I'm curious which other languages follow a similar model of header files. Specifically, in which other languages is it idiomatic to edit pairs or groups ...