Each airline has its own published rules about the maximum size for carry-on luggage, and on how many pieces you can haul along. Check with your carrier, but for most airlines it is something like about 45 linear inches (height + width + length has to add up to less than 45 inches total). Others will tell you no bigger than 24×16x 10 inches. Most will limit you to one or maybe two pieces per seat.
If you'd like to know what your airline says about size restrictions, please take a look at this site for a summary of most airlines' carry-on size restrictions.
That said, the truth is that each carrier is free to change the rules when they need to. A full plane can cause the carrier to “ask” people to check more baggage and carry on less. Even though the linear inches thing might be the published standard, your javelin case that is 40 inches long and 2 inches wide is not going to fit under the seat in front of you. And, if you reserved a bulkhead seat, you have no seat in front of you. Or, if the people who took advantage of the pre-boarding brought aboard everything but live poultry, there may be no more room no matter what.
Lastly, counting how many pieces one has is an inexact science. For example, does a woman who boarded with a small suitcase and a large purse have one or two pieces? How about a business person with an attache case and a laptop? How do you count a folding stroller?
The bottom line is this: carry on what you know you'll need in flight (toys, snacks, diapers) and (not or"¦) what you could not survive at your destination without (your child's inhaler, passport, money) if your checked luggage is lost. Anything else you get on board is gravy. Be prepared to shift these items around if you put them into two bags and are told it is a full flight and the airline is going to hold you to (really) only one item.
If you have bought a full seat for a child, you can sometimes successfully persuade the counter person that you can bring on one piece for THAT seat and one piece for YOUR seat, even if you are carrying both bags. Again, smile, relax, think zen thoughts, because this type of interaction leaves the counter person with enormous discretion.
The counter person is concerned about safety, about the comfort of other passengers, about getting to the next person in line. You don't want to do anything unsafe, or impolite to your seatmates, but a calm, reasonable approach is more likely to swing that discretion your way than demanding something you may not be darn entitled too and making it easy for the person to say no.
I've been on the pointy end of rude customer service, and I have been behind a counter (I don't work for an airline by the way, but in a service-oriented business). I can say that it is no fun either place, so be nice, be patient and if you don't get your carry on on the plane, you still board calm and not cranky. Peace.