The length of stellar bars in SB galaxies and N-body simulations